1, brief introduction

Qt Is a famous cross platform C++ GUI application development framework . It's not just a GUI library , More like a “ one-stop ” Solutions for , You don't need to study anymore
STL, You don't have to go around looking for resolution anymore XML, Connect to database , Access to various third-party libraries of the network , because Qt Built in these technologies .

2, Related links

Official website :https://www.qt.io/ <https://www.qt.io/>
Official download link :
http://download.qt.io/ <http://download.qt.io/>
Qt Download link :
http://download.qt.io/archive/qt/ <http://download.qt.io/archive/qt/>
Qt Creator Download link :
Qt VS Development plug-in download link :
http://download.qt.io/archive/vsaddin/ <http://download.qt.io/archive/vsaddin/>
Qt Official document link :
http://doc.qt.io/ <http://doc.qt.io/>

3,Qt,Qt Creator,Visual Studio, Relationship with compiler

Qt It's like a sealed one SDK.
Qt Creator Equivalent to a IDE, And Visual Studio Similar different products .
IDE You can use the specified compiler and debugger to compile and debug programs .

Visual Studio Default to Microsoft's - Microsoft Visual C++ Compiler(cl.exe) To compile a program , use
Debugging Tools for Widows(cdb.exe) To debug the program .

Qt Creator You can use Microsoft's compiler and debugger to develop , It can also be used MinGW(GCC) To compile , use GDB As debugger .

To summarize ,Qt stay Windows Several schemes of development environment under :

IDE compiler debugger
VS cl cdb
Qt Creator cl cdb
Qt Creator MinGW(gcc) gdb
be careful : When using vs To develop qt Application time , Need to install an official VS Develop plug-ins , There's a link on it .

4, about Qt Quick,QML

Qt Quick yes Qt 4.7 A new technology introduced in (QML Framework of ), Let users use
QML Develop applications faster and more efficiently , Designed to UI Separation from background logic maximization , Unified desktop and mobile .
QML yes Qt Quick A scripting language supported in development framework , Similar functions html + css + js The combination of , It's just that there's a difference .
import QtQuick 2.4 import QtQuick.Window 2.2 import QtQuick.Controls 1.2 /*
This is a multiline comment , and c The same language */ // Of course, it's a single line comment Window { id:root; //
Window Element's id, It should be guaranteed here qml Unique name in file visible: true; width: 460; // Specify the width of the window directly height:
288; // Specify the height of the window directly Image { id: bg; width: parent.width; // The width of the picture depends on the width of the parent window height:
parent.height; // The height of the picture depends on the height of the parent window source: "qrc:///images/sky.jpg" // Quote a picture }
Image { id: rocket; x: (parent.width - width) / 2; // Picture position horizontal center y: 40; //
Picture position distance from parent window 40 source: "qrc:///images/rocket.png"; } Text { // Not specified id, That is, this is an anonymous element
y:rocket.y + rocket.height + 20; // Text top distance rocket Bottom of picture 20
anchors.horizontalCenter: parent.horizontalCenter // Set text horizontal center text:
qsTr(" rocket launching !"); // Set text for text display color: "#ff2332"; // Set text color font.family: " Regular script "; //
Set font to italics font.pixelSize: 30; // Set text size } } // from :
Qt Quick Application yes QML and C++ The combination of , It's more suitable for interface class .
Qt Widgets Application It's traditional c++ frame .

5,Qt Differences between versions

6,VS + VS Develop plug-ins + Qt Environment construction

Install the appropriate version of Visual Studio

I installed vs2013, This is not introduced

download Qt, install

The version I downloaded is :

You can download it as you need , The default installation is enough .
My installation path is :
be careful : If you want to generate 32 Bit application , Still need to download another one 32 Bit version :

Please change the directory during installation , such as C:\Qt\Qt5.3.2_x86

download VS Develop plug-ins , install

The version I downloaded is :

Default installation

set up

Stay up 3 After all are successfully installed , open vs2013, You will find that there is one more menu bar QT5 's menu .
Stand alone this menu , choice Qt Options, Select in the pop-up dialog box Qt Versions tab , Click on the Add Button , New settings will pop up Qt Version dialog , stay
Version name Enter version name in ( At will ),Path Middle input Qt Installation location .
What I set up is :
Version name : msvc2013_64_opengl_532
Path : C:\Qt\Qt5.3.2\5.3\msvc2013_64_opengl

New test project

After setting , stay vs Select new item from the menu of . You will find that there is one more in the project template Qt5 Project Options for , Select on the right Qt Application
, Fill in project name and location , determine , There is a project setting in the project wizard , You can choose the components you need , such as
Quick,QML,Newwork,OpenGL,SQL,WebKit,XML. Click Finish , It creates a default empty Qt Project .

Compile run

Qt The default output directory of the project is Win32\Debug,Win32\Release,x64\Debug,x64\Release.
If you compile , appear Qt Module computer type “x64” And target computer type “X86” Conflict like error ,
The solution is to right-click on the current project , choice Qt Project Settings, stay Properties Tab Version Select the corresponding
Version name.
And according to Qt Version of , Select the right item in the platform of project properties (Win32 or x64),
But also in Linker - senior - Target calculator Select the correct item in (MachineX86 (/MACHINE:X86) or MachineX64
be careful : compile 32 Bitwise sum 64 When the application of bit , The corresponding Qt edition , Corresponding Version name, If it's installed on your computer at the same time 32 Bitwise sum 64 Bitwise Qt.
pack :
At the start menu , Select the appropriate version of Qt Command line tools “Qt 5.3 for Desktop (MSVC 2013 OpenGL)”,
Switch to packaging directory ,( such as ***\Packet\), Copy the application to it first ( For example QtDemo.exe),
Enter in the command line :
windeployqt QtDemo.exe It's going to take all Qt Copy all dependencies to packaging directory .