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

30,346

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.

Share:
30,346
joseph kalathil
Author by

joseph kalathil

Updated on December 11, 2020

Comments

  • joseph kalathil
    joseph kalathil over 3 years

    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?