Qt is a popular application framework to develop cross-platform GUI applications. Installing and using it on Windows is quite easy:
- From the Qt downloads page, download a Windows installer. The online installer is the best choice, since it allows you to install Qt built for all types of platforms. However, I found that the online installer was very slow and would stop downloading after a while. So, I decided to go with an offline installer. For Windows offline installers, you need to decide among these parameters: compiler (MinGW or Visual C++), compiler version (Visual Studio 2010 or 2012), architecture (32-bit or 64-bit) and OpenGL support. Depending on the combination you pick, say
Visual Studio 2012 32-bit with OpenGL, you can find a corresponding installer for offline installation. Download and run the installer and it will install Qt source, libraries and tools under
C:\Qtdirectory. The actual executables will be placed in a deeper directory. For example, mine were in
From the Start menu, open Qt Creator. This is the IDE that needs to be used to write a Qt application.
In Qt Creator, create a new project by choosing
File > New File or Project. Choose
Qt Widgets Applicationif you want to create a GUI program. In the following dialogs, you will be asked to provide a name for the project, directory to store the files and a kit to use for compilation.
This creates a project file with extension
.proand three source files:
To compile this project, right-click on the project name in Projects section and choose
Run qmake. This runs
qmakewhich creates Makefiles relevant to your environment. Right-click on project name again and choose
Build. This uses the Makefiles that was created earlier to build an executable. Finally right-click and choose
Run. This runs the executable, which should result in an empty window being displayed. From here on, you can add source code to these files or more source files to extend this window into a Qt application.
Tried with: Qt 5.2.0, Visual Studio 2012 and Windows 7 x64