6

Using MSVC 2008 SP1, and qt-vs-addin-1.1.2

I have a pre-existing project in MSVC that I have QT'ified: In main I added a QApplciation, and my windows are now all QWidgets. I added custom build steps for my .qrc and .ui files and "moc" as a custom build step on any Q_OBJECT header files.

This all functions - the project builds and runs, and the variant on XCode works too.

However my project still behaves differently to a project created using the Qt wizard :- Namely the Qt addin does NOT set the QTDIR build variable. Nor does it offer any of the Qt configuration options on the project context menu - they're all greyed out.

I can work around the QTDIR issue by setting the default QTDIR in my environment. But I would like to resolve what the Qt addin has done to the project - eyeballing the (xml) vcproj file of a Qt generated project vs a Visual Studio project does not reveal any obvious signs of what the Qt-addin is looking for to treat the project properly.

Chris Becke
  • 34,244
  • 12
  • 79
  • 148

1 Answers1

12

QTDIR is added as a Property in the Visual Studio Project User Option file for your project. The file has the extension .vcxproj.user, and is in the same directory and has the same base name as your project file. As far as I can tell there is no way to modify, add or delete the QTDIR property besides directly editing the file.

Note, this property can be put in other files besides the User Option file. I placed it in a property sheet, so all I have to do to setup a Qt project is to add a property sheet.

Jade
  • 3,156
  • 1
  • 34
  • 44
  • This is the solution, thank you. Amazing how IDEs can have entirely too many dialogs and project settings, and still manage to hide important stuff in obscure files. Xcode does it too. – Daniel Saner Nov 01 '12 at 16:41
  • Does these parameters in `*.vcxproj.user` override system environment variable? – kyb Oct 03 '17 at 14:42
  • The vcxproj.user files *should* be created at build time if they do not exist - at least, that is my experience. However, I have found that with a clean source checkout (no archived vcxproj.user files), running VS 20017 15.9.13, using Qt 5.13.0, the newly-created files for some reason do not contain the $QTDIR setting. Seems like something is broken in the Qt integration with those versions since it seemed to work OK with Qt 5.12.2 and VS 2017 15.9.11. It can be manually added to the files or from VS right-click the project, select Qt Project Settings, change it, save, then change it back. – GTAE86 Jul 08 '19 at 13:35