Here is a guide to get started with QT programming (qt4 in this case) on Kubuntu 9.10. You will need the demo and the Graphical development tool
A. Setting up the environment
Step 1: Install the libraries and compilers. This include libraries such as "QLabel" and QLayout from the QtGui
$ sudo apt-get install build-essential kdelibs4-dev libqt4-qt3support libqt4-assistant
Step 2: Install the demos
$ sudo apt-get install qt4-demos
Step 3: Configure Linux to compile with qt4 instead of the default qt3
$ sudo update-alternatives --config qmake
Step 4: # install the Graphical development tool
$ sudo apt-get install kdevelop
Step 5: Read info on QT4 through the manuals at /usr/share/qt4/doc/html/index.html
$ assistant-qt4
B. General programming setup of project, compiling and execute
Step 1: Create the source files. E.g. .cpp, .h, etc.
Just copy from the demo files in /usr/lib/qt4/examples. I will use files from the example tabdialogs.
$ cp -r /usr/lib/qt4/examples/dialogs/tabdialog/ ~
$ cd ~/tabdialog
Step 2: Create the project file. The project file (.pro) define headers, sources, form and other files which the application consists of.
$ qmake -project
Step 3: Compile
$ qmake
$ make
Step 4: Run the programmes.
$ ./tabdialog
Alternatively, use the KDevelop to manage the project. Start KDevelop and open to .pro file.
$ kdevelop
C. References
- http://zetcode.com/tutorials/qt4tutorial/
- http://sector.ynet.sk/qt4-tutorial/my-first-qt-gui-application.html
- http://qt-apps.org/
No comments:
Post a Comment