QT Installation For Visual Studio: RE Requisites
QT Installation For Visual Studio: RE Requisites
The steps for a successful integration of Qt in Visual Studio IDE are as follows:
PRE-REQUISITES:
• Make sure the platform SDK is installed if using Visual Studio Express.
• Visual Studio Express and the platform SDK can be downloaded freely from Microsoft
downloads.
That’s it QT is now installed. You can follow the tutorials to use Qt.
* For Express Editions (since this plugin doesn’t get installed on Express edition), follow the instructions
given at a later section. (Non‐plugin Step)
• This add-in facilitates the creation of a Qt project in Visual Studio.
• Download the patch at: ftp://ftp.qtsoftware.com/vsaddin/
• Download the latest one.
• Install (make sure Visual Studio is closed before installing).
• Once install is done. Open Visual Studio. Go to the “QT” menu as follows: Qt > Qt
Options
• Click on “ADD”. Put a version number there and the path where Qt is. E.g.
C:\Qt\2009.01\qt
• Click ok.
• Done. Now Qt template is integrated inside VS.
• Finish.
• This will create a plain project and main.cpp containing the following
#include <QtGui/QApplication>
#include "test_application.h"
If not using the Visual Studio Add-In plugin (for Express Editions Users), then you need to follow the
steps here to create a project in Visual Studio.
• Once created, it will create the necessary files and a UI file. Here you can play with your UI
to create the desired GUI.
• We shall add a resource file to the project. File->New
• Select Resource File
• Rename it. Here since I used myApp as the name all over, my resource file is named as
myApp.qrc
• Now build the project in QtCreator itself. Build -> Build All
• This step create the Q_Object generated files which is required when we going to use in VS.
• Now copy the following files from the QtCreator Project folder to the myVsApp
application folder:
o main.cpp
o myapp.cpp
o myapp.h
o myapp.ui
o myapp.qrc
• Now we need to link the libraries to the project. Follow the steps below to link the necessary
files.
• Under Project->Properties, use Configuration: All Configurations.
• Under Configuration Properties -> Debugging -> Environment:
o PATH=$(QTDIR)\bin;$(PATH)
o UNICODE,WIN32,QT_THREAD_SUPPORT,QT_CORE_LIB,QT_GUI_LIB
• That’s it. Compile. Run. ☺ … When we generated the project from QCreator, it had
created the sample code in it. So to test here, just compile and run.
• Now, if u double click on myApp.ui from the solution explorer, it will send you to Qt
designer. U can change design there, but since we not using the plugin, it won’t
automatically change the files here.
• So the best way is to open the PRO file with QCreator, and edit the UI file there and save
and build. It will create the ui_myapp.h file also.
• Then replace the existing ui file, ui_myapp.h, and qrc_myapp.cpp in the project by the
newly generated ones to reflect the update.