<< to CrossControl homepage

Support & Service Center

Transition from Qt 4.x based projects to Qt 5

Printer-friendly versionPrinter-friendly versionPDF versionPDF version

The transition from Qt 4.x to Qt 5 is not expected to be significant. However, the “modularization” of the Qt5 code base requires some amount of changes to project configuration, such as use of “headers”, and configuration of project build settings (such as changes to the *.pro files).

We refer to the documentation available on Qt Project for further details, found here.

To determine if a project is being built using the Qt4 or Qt5 toolchain, it is possible to add the following line to the *.pro-file to check which version that is currently being used:

// Add widgets if the project is built using Qt5
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

A similar way can be applied for *.h- or *.cpp-files when required:

#include <QtWidgets/QApplication>
#include <QtGui/QApplication>