Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Visual Studio 2017 with Qt to develop GUI applications?

I have searched everywhere but I can't seem to find support for the latest Visual Studio version.

Is there some way of getting round this?

like image 393
joseph kalathil Avatar asked Jul 18 '17 10:07

joseph kalathil


People also ask

Can you use Qt with Visual Studio?

In Microsoft Visual Studio, select Extensions > Manage Extensions > Online, and search for Qt Visual Studio Tools to install or update Qt VS Tools.

Is Qt good for GUI?

Qt for Python is one of the best GUI framework available for Python. We can build standard desktop GUI applications but the framework also comes with a lot of features such as data visualization or OpenGL support. The developer tools available are another powerful feature of the framework.

How can I add Qt version in Visual Studio 2017?

Under tools select Extensions and Updates. click the Online arrow on the left and search for Qt. Install the Qt Visual Studio Tools extension. Restart the Visual Studio 2019 IDE and under Qt VS Tools –> Qt Options add the Qt version 5.14 with associated directory C:\qt\5.14.


1 Answers

Qt 5.9.1 and later versions are pre-built for VS 2017 64 bits. You can download it from official Qt webpage. If you need 32 bits I'm sorry to tell you that you will need to compile it manually (good luck, it is usually not a straightforward nor simple process). See updates below.

In addition, you will need the VS Tools. You can download latest version for VS 2017 from here (official downloads page hasn't been updated yet about this). There is no stable version for VS 2017 (see update below), but the latest (although a bit old) development build fixes major integration problems. You can downloaded from here.

Finally, just take a look at the official documentation for a quick tutorial about how to use it. Basically:

  • Configure your Qt version with the VS Tools: in VS go to Qt VS Tools > Qt Options and add your installation.
  • You can now create a new project. The extension will add a new templates collection under Visual C++ called Qt, there you will probably use the Qt GUI Application.
  • The rest is standard Qt programming. The VS Tools take charge of all the compilation of .ui files (interface design), moc'ing needed files, translations (if used), etc.

UPDATE: as mentioned in this post from MSDN, binaries generated usign VS 2015 are compatible with VS 2017. So in this case, the Qt compilations for 2015 (32 and 64 bits) should also work.

UPDATE (2018-9-13): since two months ago we've been using the 32-bits build from VS 2015 in VS 2017 (including the latest 15.8.4 update). No issues found so far in this sense.

UPDATE (2018-12-10): Qt 5.12.0 (LTS) comes with precompiled binaries for VS 2017 32 and 64 bits.


UPDATE: last February was launched the first official release of the VS Tools for VS 2017. You can read more on it in the Qt's blog.

like image 115
cbuchart Avatar answered Sep 19 '22 14:09

cbuchart