Change Qt Version Visual Studio

Active4 years, 11 months ago

Sep 30, 2014  CMake is also an answer and it does work with express versions of Visual Studio. I mean if you use the Qt support in CMake you can develop Qt projects in Visual Studio (like I have done for years) without the Qt Addon. I install the addon just for the debug expansion that comes in. How to configure Qt to support Visual Studio 2017, I have downloaded and installed the latest version of Qt (VS2015) which seems not working with VS 2017. If this version of Qt is not supported VS2017, then the next version when will be released?

I recently started using Qt library and I've got a question.Is this possible to use Qt with Visual Studio without special add-in?

I want to just design the UI using qt designer and do the rest in VS Express.How do I do that?

Thanks.

user2180248user2180248

4 Answers

Yes you can, if you would prefer not to use the QtVSAddin it is very easy to use Qt with VS Express without the VS add-in and without having to do any of the uic or moc steps manually. Let QMake (installed with Qt but not part of the QtVSAddin) create your VS project file and do all your project setup in a qmake project file. Whenever you make a change like adding/removing a form or source, modify the qmake project file and regenerate the VS project. Don't modify the VS project file at all, treat it only as a temporary item. QMake will add the rules automatically to the VS project file to rerun uic and moc, you don't need to do anything if you're just modifying source code or forms.

For configuration management purposes I find this a much cleaner approach to use this workflow as you treat the VS project file as only a temporary item (they tend to diff badly and are a pain to maintain in version control).

Qt Vs Visual Studio

A couple snippets to help you out:

In your qmake project file ensure you add the following line into it so that VS project files are generated when running on Windows (qmake defaults to generating a makefile).

your_qmake_proj.pro

Download Qt For Visual Studio

Additionally, it's convenient to have a batch file to rerun qmake so you don't have to bring up a command prompt and set environment up (or change directory to your project in a command prompt that already has the environment setup). If you haven't set the various Qt environment variables with Windows (or prefer not to) make sure to add them to your batch file.

makevcproj.bat

Community
LinvilleLinville
2,8921 gold badge18 silver badges32 bronze badges

CMake is also an answer and it does work with express versions of Visual Studio. I mean if you use the Qt support in CMake you can develop Qt projects in Visual Studio (like I have done for years) without the Qt Addon. I install the addon just for the debug expansion that comes in the same package.

drescherjmdrescherjm
6,9754 gold badges35 silver badges54 bronze badges

It is certainly possible, but without the add-in you will need to UI and MOC the needed files either before you compile the rest within VS, or through pre-compile scripting.

Change Qt Version Visual Studio

Specifically:

uic generates the headers from .ui files.

and

moc generates the additional implementation files for classes that has Qt macros in it.

The add-in helps you call these smoothly on the required files before compiling the rest.

meyumermeyumer2017
4,5111 gold badge12 silver badges21 bronze badges

It's is possible if you create the UI in QtCreator and manually setup VS in a way that generate the UI and MOC files.

But it's too much work and you can use QtCreator which is an amazing light IDE.

lmedinaslmedinas

Not the answer you're looking for? Browse other questions tagged c++qtuser-interface or ask your own question.