Qt for Windows - Requirements
This page describes the required libraries and environment for Qt for Windows.
Libraries
The following libraries may be used when running Qt 5 applications in Windows. These are not mandatory, but some components (for example, Qt WebKit) may depend on them.
- ICU: Qt 5 can make use of the ICU library for enhanced UNICODE and Globalization support (see QTextCodec, QCollator::setNumericMode()).
At compile time, the include and lib folders of the ICU installation must be appended to the
INCLUDE
andLIB
environment variables. At run-time, the ICU DLLs need to be found by copying the DLLs to the application folder or by adding the bin folder of the ICU installation to thePATH
environment variable. - ANGLE: This library converts OpenGL ES 2.0 API calls to DirectX 11 or DirectX 9 calls (depending on availability), removing the need to install graphics drivers on the target machines. Building the library requires the installation of the Direct X SDK. More information is available at http://code.google.com/p/angleproject/wiki/DevSetup
Note: When building for 64-bit environments, de-activate the
WarnAsError
option in every project file, otherwise, integer conversion warnings will break the build.
Support for Secure Sockets Layer (SSL) communication is provided by the OpenSSL Toolkit, which must be obtained separately. See Secure Sockets Layer (SSL) Classes for instructions on building Qt with SSL support.
ICU
Qt WebKit, and applications using it, always need the ICU libraries. Qt Core can be configured to either rely on ICU functionality, or fall back to Windows API and internal algorithms with somewhat reduced functionality.
From Qt 5.3 and onwards, configure does not link Qt Core against ICU libraries anymore by default. This reduces the size of a self-contained application package considerably, as long as Qt WebKit is not used.
Letting Qt Core utilize the ICU libraries however has following advantages:
- Behavior matches other platforms more closely.
- Extended set of text codecs (see QTextCodec).
- QLocale::toUpper(), QLocale::toLower() always use case conversion rules specific to the locale.
- QCollator::setNumericMode() does work consistently on all Windows versions.
To explicitly enable the use of ICU in Qt Core, pass -icu
to configure
:
configure -icu
Graphics Drivers
For Qt Quick 2 to work, a graphics driver that provides OpenGL 2.1 or higher is required. The default driver from Windows is OpenGL 1.1. Qt includes a version of the ANGLE project which is included from the Windows Qt installers. ANGLE implements the OpenGL ES 2.0 API on top of DirectX 11 or DirectX 9. ANGLE requires that the DirectX SDK is installed when building Qt.
ANGLE chooses the render backend depending on availability. DirectX 11 is usually preferable. However, some graphics cards may not fully support it. For these cases, the environment variable QT_ANGLE_PLATFORM
(introduced in Qt 5.4) can be used to control the render backend. Possible values are d3d11
, d3d9
and warp
.
To use a custom version of ANGLE, set the ANGLE_DIR
environment variable to point to the ANGLE source tree before building Qt.
If you installed additional OpenGL drivers from your hardware vendor, then you may want to consider using this version of OpenGL instead of ANGLE. To use OpenGL, pass the command line options -opengl desktop
to the configure script.
configure -opengl desktop
To use an OpenGL ES 2.0 emulator instead of ANGLE, use the configure options: -opengl es2 -no-angle
.
configure -opengl es2 -no-angle
Dynamically Loading Graphics Drivers
In addition to the build time configuration, Qt supports choosing and loading the OpenGL implementation at runtime. To use this mode, pass -opengl dynamic
to the configure script.
configure -opengl dynamic
Note: As of Qt 5.5 this is the configuration used by the official, pre-built binary packages of Qt. It is strongly recommended to use it also in custom builds, especially for Qt binaries that are deployed alongside applications.
Note: Combining -opengl dynamic
with -static
is also possible, but be aware that ANGLE will not be statically linked into the applications in this case, it will still be built as a shared library.
This configuration is the most flexible because no dependencies or assumptions are hardcoded about the OpenGL implementation during build time. It allows robust application deployment. When a given environment fails to provide a proper OpenGL 2.0 implementation, it will fall back automatically to ANGLE. This fallback will be completely transparent to the application, and will allow Qt Quick or other OpenGL code to function by translating to Direct3D. Such a fallback could, for example, take place on a Windows 7 PC with no additional graphics drivers installed. On other machines, where there is sufficient OpenGL support, the normal desktop OpenGL drivers will be used. Additionally, pure software-based OpenGL implementations may be available as additional fallbacks in the future, allowing running Qt Quick applications without a GPU.
When configured with -opengl dynamic
, neither Qt nor the applications built using qmake
will link to the opengl32 (standard desktop OpenGL) or libGLESv2 (ANGLE) libraries. Instead, the appropriate library is chosen at runtime. By default, Qt will determine whether the system's opengl32.dll provides OpenGL 2 functions. If these are present, opengl32.dll is used, otherwise the ANGLE libraries will be used. In case the ANGLE libraries are missing or initialization fails for some reason, an additional fallback is attempted by trying to load opengl32sw.dll
. See below for details.
The loading mechanism can be configured through the QT_OPENGL
environment variable and the following application attributes:
Qt::AA_UseDesktopOpenGL
Equivalent to settingQT_OPENGL
todesktop
.Qt::AA_UseOpenGLES
Equivalent to settingQT_OPENGL
toangle
.Qt::AA_UseSoftwareOpenGL
Equivalent to settingQT_OPENGL
tosoftware
.
When a certain configuration is requested explicitly, no checks are done at application startup, that is, the system-provided opengl32.dll will not be examined.
The dynamic loading has a significant impact on applications that contain native OpenGL calls: they may fail to link since qmake
no longer automatically adds opengl32.lib or libglesv2.lib. Instead, applications are expected to use the OpenGL functions via the QOpenGLFunctions class. Thus the direct dependency on the OpenGL library is removed and all calls will be routed during runtime to the implementation chosen by Qt.
Applications that require a certain OpenGL implementation (for example, desktop OpenGL due to relying on features provided by OpenGL 3.0 or higher) should set the application attributes Qt::AA_UseOpenGLES
or Qt::AA_UseDesktopOpenGL
before instantiating QGuiApplication or QApplication. When these attributes are set, no other OpenGL implementations are considered. Additionally, if they wish to, such applications are free to make direct OpenGL function calls by adding opengl32.lib to their .pro project files: LIBS += opengl32.lib (Visual Studio) or LIBS += -lopengl32 (MinGW). The result is, from the application's perspective, equivalent to the -opengl desktop
build configuration of Qt.
Qt::AA_UseSoftwareOpenGL
is special in the sense that it will try to load an OpenGL implementation with a non-standard name. The default name is opengl32sw.dll
. This allows shipping a software-only OpenGL implementation, for example a build of Mesa with llvmpipe, under this name. If necessary, the filename can be overridden by setting the QT_OPENGL_DLL
environment variable.
It is possible to provide a JSON-format configuration file specifying which OpenGL implementation to use depending on the graphics card and driver version. The location is given by the environment variable QT_OPENGL_BUGLIST
. Relative paths are resolved using QLibraryInfo::SettingsPath
or QStandardPaths::ConfigLocation
. The file utilizes the format of the driver bug list used in The Chromium Projects. It consists of a list of entries each of which specifies a set of conditions and a list of feature keywords. Typically, device id and vendor id are used to match a specific graphics card. They can be found in the output of the qtdiag
or dxdiag
tool.
The following feature keywords are relevant for choosing the OpenGL implementation:
disable_desktopgl
- Disables Desktop OpenGLdisable_angle
- Disables ANGLEdisable_d3d11
- Disables the D3D11 rasterizer in ANGLEdisable_d3d9
- Disables the D3D9 rasterizer in ANGLE
A sample file looks like:
{ "entries": [ { "id": 1, "description": "Disable D3D11 on older nVidia drivers", "os": { "type": "win" }, "vendor_id": "0x10de", "device_id": ["0x0DE9"], "driver_version": { "op": "<=", "value": "8.17.12.6973" }, "features": [ "disable_d3d11" ] }, ...
When QT_OPENGL_BUGLIST
is not specified, a built-in list will be used. This typically includes some older, less-capable graphics cards with disable_desktopgl
set, in order to prevent Qt from using their unstable desktop OpenGL implementations and instead fall back to ANGLE right away.
Building from Source
These tools are not needed to run Qt 5 applications, but they are required for building Qt 5 from source.
- ActivePerl - Install a recent version of ActivePerl (download page) and add the installation location to your
PATH
. - Python - Install Python from the here and add the installation location to your PATH in order to be able to build Qt WebKit.
- Install Ruby from here and add the installation location to your PATH in order to be able to build Qt WebKit.
Note: Please make sure that the perl
executable from ActivePerl is found in the path before the perl executable provided by msysgit, since the latter is outdated.
Qt WebKit and ANGLE depend on these extra tools from the GnuWin32 and Win flex-bison projects, which are provided for your convenience in the gnuwin32/bin folder:
The gnuwin32/bin folder should be added to the PATH
variable.
Note: If you are building qtbase outside of qt5.git, you will need to download win_bison and win_flex from the link above and rename them to bison and flex.
For instructions for building the Qt 5 source, read the Qt for Windows - Building from Source page.
SDKs and Compilers
A Windows SDK is required to develop Qt applications on Windows.
- Windows SDK 8 (with Visual Studio 2012 Express). As of Windows 8, the SDK no longer ships with a complete command-line build environment. You must install a compiler and build environment separately. If you require a complete development environment that includes compilers and a build environment, you can download Visual Studio 2012 Express, which includes the appropriate components of the Windows SDK. (Download page)
- Windows SDK 7.1. Note that, as of 16.3.2012, if you use this SDK with Visual Studio 2010, installing the SDK requires installing the following packages in this order (see readme.html provided with the service pack):
- Install Visual Studio 2010
- Install Windows SDK 7.1
- Install Visual Studio 2010 SP1
- Install Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1
- Windows SDK 7.
- A MinGW toolchain with g++ version 4.7 or higher. Qt 5 is tested regularly with a 32 bit gcc 4.9.1 toolchain from the MinGW-w64 project.
For the most up to date information about the Qt WebKit dependencies, please refer to the Qt WebKit Wiki for Windows.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.