One: Install
Here is an example with VS2019
(1) VS2019
Official website download vs2019
Mainly installed C++ modules:
(2) Install QT 5.14
Official website installation address: https://download.qt.io/archive/qt/
You can also use Tsinghua Mirror: Tsinghua Open Source Software Mirror Station | Tsinghua Open Source Mirror
Official website example:
Click 5.14/ -> 5.14.2/ in turn
After downloading, you can install Qt. Note: before installing Qt, it is best to disconnect from the network (the version before 5.14 can be installed without the network, and it must be installed online after 5.15), otherwise you cannot next, and you need to register an account, which is very troublesome.
Check the version you need. It is recommended to check both 32 and 64 bits. There is no VS2019, but the vsaddin plug-in can still find the Qt of VS2017. The main screenshots of the installation steps are as follows:
(3) Install vsaddin
Official website download address: https://download.qt.io/archive/vsaddin/
The source address of the Tsinghua mirror image is listed in the previous item.
Choose the version you want to install
Then select the corresponding file according to your vs version:
Before installing the plug-in, close VS, Qt, the plug-in will automatically recognize the version of VS
Two: Set the Qt path
After all the above are installed, open VS, create a new C++ project arbitrarily (or open any project you already have), and set the Qt path. If you don’t set the Qt path, you may create a qt project like this:
The specific setting method is as follows:
Three: Create a QT project
After the Qt path is set, create a new Qt program, you can choose GUI program and console program,
Enter "qt" in the template search box, then slide down to select the last one:
Select the Qt version and compilation method, and select debug. After creation, if you want to release with release, you can change it to release in vs.
Open the ui file and you can drag and drop the controls. If you want to write the ui by hand, you can just create a new Qt class. Other compilation and debugging are the same as C++ projects.
If the Windows system version is too low, compilation may fail. It is recommended to update the Windows system, at least to a version after 19041.
The above is the configuration of the VS2019 Qt development environment. One point: for projects developed with VS Qt, try not to change the version of VS Qt frequently. Different versions of VS Qt may not be able to compile after opening the project.
The VS Qt project can also be converted into a QtCreator project, and the configuration and third-party dependencies are changed. When cross-platform, special libraries are specified with macros. If you don’t want to cross-platform, you can just do it on VS.