Sunday, July 4, 2010

Using Qt Creator to create qmake-base project

- Start Qt Creator
- Click File -> New File or Project...
- Select Other Project from the Projects box on the left, and Empty Qt Project from the box on thr right. Then click Choose...


- Enter the name and location of the project, then click Next, and Next.and Finish.




Now, you can see a empty project without any source code inside.


- Click File -> New File or Project...again
- Select C++ from the Files and Classes box on the left, and C++ Source File from the box on the right, and click Choose...


- Enter the name of the file, ex. main.cpp, and click Next, and Finish.



Enter the code into the file main.cpp.

#include
#include

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello World Qt!");
label->show();
return app.exec();
}



Save All, and Run (by clicking on the green arrow button, or Ctrl+R key)