IGOS Nusantara dan Qt: Perbedaan revisi
Dari IGNwiki
| Baris 40: | Baris 40: | ||
== Contoh Program GUI == | == Contoh Program GUI == | ||
| + | |||
| + | Contoh1 | ||
#include<QApplication> | #include<QApplication> | ||
| Baris 50: | Baris 52: | ||
label.show(); | label.show(); | ||
a.exec(); | a.exec(); | ||
| + | } | ||
| + | |||
| + | |||
| + | Contoh2 | ||
| + | |||
| + | #include <QApplication> | ||
| + | #include <QPushButton> | ||
| + | |||
| + | int main(int argc, char **argv) | ||
| + | { | ||
| + | QApplication app (argc, argv); | ||
| + | |||
| + | QPushButton button ("Hello world !"); | ||
| + | button.show(); | ||
| + | |||
| + | return app.exec(); | ||
} | } | ||
Revisi per 27 Agustus 2014 02.16
yum -y install qt qt-devel g++ -o qthello -I/usr/include/QtCore -I/usr/include/QtGui -lQtGui -lQtCore qthello.cpp
Daftar isi
Unduh
Akses ke: http://download.qt-project.org/archive/qt/5.3/5.3.1/
Unduh:
qt-opensource-linux-x86-5.3.1.run 24-Jun-2014 10:31 447M qt-opensource-linux-x64-5.3.1.run 24-Jun-2014 10:30 444M
Versi single: http://download.qt-project.org/archive/qt/5.3/5.3.1/single/
Unduh:
qt-everywhere-opensource-src-5.3.1.tar.xz 24-Jun-2014 10:49 169M Details
IGN 32 bit
$ wget download.qt-project.org/official_releases/qt/5.3/5.3.1/qt-opensource-linux-x86-5.3.1.run sudo chmod +x qt-opensource-linux-x86-5.3.1.run ./qt-opensource-linux-x86-5.3.1.run
IGN 64 bit
$ wget download.qt-project.org/official_releases/qt/5.3/5.3.1/qt-opensource-linux-x64-5.3.1.run chmod +x qt-opensource-linux-x64-5.3.1.run ./qt-opensource-linux-x64-5.3.1.run
Pasang
# yum install libxcb libxcb-devel xcb-util xcb-util-devel xcb-util-*-devel libX11-devel libXrender-devel libXi-devel
Contoh Non GUI
#include<QtCore>
int main(){
qDebug() << "Halo Dunia\n";
}
Contoh Program GUI
Contoh1
#include<QApplication>
#include<QLabel>
int main(int argc, char *argv[]){
QApplication a(argc, argv);
QLabel label;
label.setText("Hello World");
label.show();
a.exec();
}
Contoh2
#include <QApplication>
#include <QPushButton>
int main(int argc, char **argv)
{
QApplication app (argc, argv);
QPushButton button ("Hello world !");
button.show();
return app.exec();
}