- API Help integration with MSDN (so F1 context sensitive help works)
- Wizards for Qt projects and skeleton apps
- Qt Designer integration for forms and layout (although this runs as a separate app)
- Automated build process (so it runs the Qt pre-processors then compiles and links the app)
Partner this with Whole Tomato Visual Assist X and you have a pretty nice Qt dev environment.
But before you can actually use Visual Studio you need to compile Qt from source so that you get the libs and DLLs that are compatible with VS. The best way to do this is to download the source Framework (not the prebuilt SDK). I think the only difference is that the framework does not contain Qt Creator.
These steps assume you already have Visual Studio 2008 installed (any version except Express, which doesn't support add-ins), and that Qt is not already installed.
- Download and run qt-win-opensource-4.5.1-mingw.exe (the version number may have changed).
- Choose a destination folder, I chose D:\Qt\4.5.1
- Select the checkbox to download and install MinGW - it is needed for the build process.
- The actual archive unpacking can take quite a while, up to 20 mins or so.
- Add Qt to your system PATH - this means the bin folder, so D:\Qt\4.5.1\bin in my case.
- Add the system environment variable QTDIR=D:\Qt\4.5.1 (substitute your path)
- Reboot your computer for the changes to take effect.
- Run the Visual Studio 2008 Command Prompt (or open an ordinary cmd.exe and run vsvars32.bat from Microsoft Visual Studio 9.0\Common7\Tools folder). This will set the environment variables for the Microsoft compiler tools.
- cd to D:\Qt\4.5.1 (not the bin folder).
- Run the command: configure -platform win32-msvc2008
- Answer O for Opensource, and agree to the license.
- It will make a new qmake.exe, then build pro files for each library and app.
- Run nmake. This can take upwards of 5 hours on a P4 3GHz machine to give you some idea. Also, it will require around 10GB of temporary scratch space to build.
- Wait for hours for the compile to finish...it will build debug and release versions of the libraries and DLLs in the \lib folder, and also all the tools and examples.
- You can delete the *.obj and *.pdb files to claim back around 9GB of disk space. The easiest way to do this is to open a Command Prompt and cd to the Qt folder. Then enter del /s /q *.obj *.pdb
- That's it! If you're a completist you can now uninstall MinGW and also delete mingwm10.dll from the Qt \bin folder, as they are not needed. Confirm everything worked by running qtdemo.exe from \bin.
- Start Visual Studio 2008.
- Click Help -> Contents. This will start MSDN and perform an update of the help files to merge the Qt documentation. This can take quite a while. As in a big cup of coffee.
- In VS select Qt -> Qt Options. Click Add and browse to the installation folder (eg D:\Qt\4.5.1). Enter a version name, eg Qt-4.5.1. Click Ok.
The screenshot above shows a Qt app being developed in VS. Notice the Qt menu and the test2.ui form file in Solution Explorer. Double-clicking the .ui file will open Qt Designer as an external app. Here you can create your GUI, then just save, head back to VS and compile. Job's a good 'un!