QT Environment Construction and HelloWorld

Source: Internet
Author: User

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

    1. #include   "mainwindow.h"   

    2. #include  < Qapplication.h>   

    3. #include  <qpushbutton.h>    

    4.   

    5. int  main ( int  argc,  Char  *argv[])   

    6. {  

    7.      qapplication a (ARGC,&NBSP;ARGV);   

    8.     qpushbutton  hello ( "Hello world" ,  0);   

    9.      Hello.resize (100,60);   

    10.     a.setactivewindow (&hello);   

    11.     hello.show ();   

    12.       return  a.exec ();   

    13. }  


Environment variables

[Plain] view plaincopy

    1. C_home F:\Program\Qt\Qt5.1.0\Tools\mingw48_32

    2. PATH%c_home%\bin

    3. Library_path%c_home%\lib

    4. C_includede_path%c_home%\include

    5. 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

    1. QT + + Core GUI

    2. GreaterThan (Qt_major_version, 4): QT + = Widgets

    3. TARGET = HelloWorld

    4. TEMPLATE = App

    5. SOURCES + = Main.cpp\

    6. Mainwindow.cpp

    7. HEADERS + = Mainwindow.h

    8. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.