Laman

Find Qt Programming Tutorial Here !

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.
Continue reading › this Qt programming  tutorial

How To Sending Message To Terminal Using qDebug and qWarning

Sometimes, the developer need to sending a message or more in a string form to the terminal to inform what happening is/was going on. It could be the error messages, the state of the program flowchart, warning messages or whatever kinds of message.

The advantage of sending message in string format to the terminal is no need GUI to show it and let's you monitor how your program flows. Thus, you can use command to sending a message to terminal. And you can see your message by starting your application you've made from terminal.

This is very easy and simple thing in Qt programming.

qDebug :
qDebug("Your message");

or you can use a QString variable like this :
QString s;
s="Your message";
qDebug(s);

qWarning :
qWarning("Your message");

or you can use a QString variable like this :
QString s;
s="Your message";
qWarning(s);
See also Qt Tutorial about :

Continue reading › this Qt programming  tutorial