Salah satu cara untuk membuat GUI (Graphical User Interface) dalam programming bahasa C++ adalah dengan menggunakan Qt.

Definisi singkat tentang Qt:
- Diambil dari kata “cute”.
- C++ class library untuk membuat GUI program.
- Dapat digunakan di multiplatform antara lain Windows, Mac OS X, Linux, Solaris, HP-UX dll.
Berikut akan gw berikan langkah-langkah dalam menginstall Qt pada Ubuntu dan Windows XP.
1. Install Qt pada Ubuntu.
Qt pada ubuntu dapat diinstall dalam 2 cara yaitu dengan cara “otomatis” dan “manual”
.
Cara Otomatis
- Buka terminal.
- ketik: sudo apt-get install qt3-dev-tools (untuk Qt versi 3) atau sudo apt-get install qt4-dev-tools (untuk Qt versi 4).
- done! Qt telah di install. Umumnya Qt akan terinstal pada /usr/shared/qt directory.
Cara Manual
1. Download Qt sourcecode “qt-x11-opensource-src-4.4.3.tar.gz” disini
2. Untar file yang sudah di donload ke directory yang ingin diinstal Qt.
3. Buka Terminal.
4. ketik: cd qt-x11-opensource-src-4.4.3
5. ketik: ./configure
6. ketik: make (ini akan memakan waktu kurang lebih 2-4 jam
)
7. setelah selesai, kita harus menambah path library ke Qt yang telah di install. Caranya ketik:
QTDIR=/usr/local/qt-x11-opensource-src-4.4.3
PATH=$QTDIR/bin:$PATH
MANPATH=$QTDIR/doc/man:$MANPATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export QTDIR PATH MANPATH LD_LIBRARY_PATH
8. done!
2. Install Qt pada Windows XP (integrasi dengan Visual C++ 2008 Express).
Qt pada windows terdiri dari 2 macam, yaitu Qt Commercial dan Qt Open Source. Gw hanya akan memberikan cara2 menginstall Qt opensource yang diintegrasi dengan Microsoft Visual Studio 2008 Express.
1. Install Microsoft Visual C++ 2008 Express. Bila belum punya, dapat di donload disini
2. Download Qt for Open Source C++ development on Windows disini
3. Unzip file Qt yang telah didownload ke C:\Qt\
4. Buka Visual Studio 2008 Command Prompt
5. Masuk ke Qt directory. cd \Qt
6. ketik: configure
7. ketik: nmake (silahkan nyuci2 dulu, tidur2 dulu, bikin kopi atau yang lainnya, karena ini akan memakan waktu 2-4 jam
).
8. Setelah selesai, kita harus mengatur environment yang baru. Caranya klik kanan pada My Computer -> Properties -> Advanced -> Environment Variables
tambahkan:
QTDIR = C:\Qt
Path = %QTDIR%\bin
9. Masuk ke Visual C++ 2008. Tools -> Option -> Project and Solutions -> VC++ Directories -> Show directories for
-> Include files.
Tambahkan:
$(QTDIR)\include
-> Library fies.
Tambahkan:
$(QTDIR)\lib
klik OK.
10. done!
Setelah selesai menginstall Qt pada Ubuntu ataupun Windows, sekarang waktunya untuk mengetes hasil instalasi dengan menjalankan Hello World!.
1. Buat sebuah folder ‘hello’ dan sebuah file ‘hello.cpp’ didalamnya.
2. Copy paste ini pada hello.cpp
#include <qapplication.h>
#include <qlabel.h>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello Qt!", 0);
app.setMainWidget(label);
label->show();
return app.exec();
}
3. buka Terminal pada Ubuntu atau Visual Studio 2008 Command Prompt pada Windows.
4. Masuk ke dalam folder ‘hello’ -> cd hello
5. ketik:
qmake -project
qmake hello.pro
make
hello (pada Windows) atau ./hello (pada Ubuntu)
6. Untuk membuat Visual Studio project file:
qmake -project
qmake hello.pro
qmake -tp vc hello.pro
Dari sini kita dapat mengcompile hello.pro di Visual Studio
Selamat mencoba.
Info lebih lanjut silahkan kunjungi website ini.


Thanks for this manual.
I am trying to install Qt on Ubuntu 8.10 for static translations. But I have problem with it
.
I have read this manual and I have two questions.
The first one is: is there need to command “sudo make install” be executed?
The second: where should be set these env-variables? In .profile ?
Sorry, I a bit forget about the step in Ubuntu.
But if I’m not wrong, u no need to command “sudo make install”, u only need to command “sudo make” to compile Qt.
after that u set the env-var in .profile file, u can find it in your account directory. for example : home/account
it is a hidden file, u can see it after you set the option to show the hidden files.
If u still can not get it installed, I suggest you to install it from the repository.
You only need to command “sudo apt-get install qt4-dev-tools”, it will automatically install Qt in your Ubuntu. It is much easier, but you need internet connection to do it.
gud luck.
Ndra, awas klo salah ye. klo ada apa2 ma ubuntunya gw kejar lo ampe cibubur.. >:D