I use QT5.1, what are packaged, and also brought Qtcreator, directly downloaded down to run
Http://qt-project.org/downloads
Qt 5.1.0 for Windows 32-bit (MinGW 4.8, OpenGL, 666 MB)
Qt5.1.0\tools\mingw48_32
QT5.1 in the MinGW 4.8, configure the MinGW environment variables, you can
HelloWorld
[CPP] view plaincopy
-
#include "mainwindow.h"
-
#include < Qapplication.h>
-
#include <qpushbutton.h>
-
-
int main ( int argc, Char *argv[])
-
{
-
qapplication a (ARGC,&NBSP;ARGV);
-
qpushbutton hello ( "Hello world" , 0);
-
Hello.resize (100,60);
-
a.setactivewindow (&hello);
-
hello.show ();
-
return a.exec ();
-
}
Environment variables
[Plain] view plaincopy
C_home F:\Program\Qt\Qt5.1.0\Tools\mingw48_32
PATH%c_home%\bin
Library_path%c_home%\lib
C_includede_path%c_home%\include
Cplus_include_path%c_home%\include\c++\3.4.5;%c_home%\include\c++\3.4.5\backward;%c_home%\include
Helloworld.pro
[Plain] view plaincopy
QT + + Core GUI
GreaterThan (Qt_major_version, 4): QT + = Widgets
TARGET = HelloWorld
TEMPLATE = App
SOURCES + = Main.cpp\
Mainwindow.cpp
HEADERS + = Mainwindow.h
FORMS + = Mainwindow.ui
In 5.1, when you manually build QT dome, you need to include the next two sentences in the *.pro file:
QT + + Core GUI
GreaterThan (Qt_major_version, 4): QT + = Widgets
QT Environment Construction and HelloWorld