Laman

Monday, September 19, 2011

How to Create Qt Project And Compile It

The beginners is usually compare about Qt programming with their currently programming environment being used. For example they compare to Visual Basic 6.0, some of the easiest GUI programming in Windows environment. Because there is a wide different between VB6.0 and Qt, not only in language but also how to create the project, this section will show you step by step creating and compiling project successfully.

In this part, I will show you the simple thing how to create your first Qt GUI application using Qt3. You can use Qt designer (designerq-qt3 in a terminal command) and then how to compile it to produce or make an executable file program.

Open Qt3 Designer
Qt Designer is similar interface to Visual Basic IDE but it's absolutely different. Qt Designer which is its executable file name is designer-qt3 is for designing the form only. It couldn't be used for compiling program or debugging. Qt Designer will show the preview of form only, unlike a Visual Basic that you can try your program by pressing F5.

But, Qt Designer is a powerful tool to design a GUI in a minute only using drag and drop Widget from toolbox like a Visual Basic. To open Qt Designer use the following command.

open terminal and type :
designer-qt3


Create Project


qt programming new project
Create C++ Project Window

qt programming new project
Select Directory Where To Place The Project

qt programming new project
Directory Where The Project Is Saved


Adding Form or Dialog

qt programming new dialog
Add New Dialog Form

qt programming save dialog
Saving Form

Create Main File

qt programming new main file
Add Main File

qt programming select main form, startup form
Select Main Form



Running qmake

qt programming list project file
List Of  Project Files



qt programming makefile
Running qmake (Generating Makefile)

To running qmake command open terminal from there and then type :
qmake

After running qmake, new Makefile file should be found there.

Make executable file



qt programming compile project
Running make (Compiling Project)
Now, you are ready to compile the project using command make.

qt programming running project
Running The Program
If compiling successfully done, the new file with the name is usually same as project name will be created and marked as executable file. This is your program, try to execute it by double clicking it.
Search newest article here :