Converting Qt 5 Projects into Qt 6 Projects

Qt Design Studio supports creating UIs with Qt 6 in addition to Qt 5. However, to make a project that uses Qt 5 use Qt 6, you have to be aware of a few differences and issues that are discussed in this topic.

Font Loader

Projects that were created with Qt Design Studio 2.1 use FontLoader in a way that is not supported in Qt 6. Specifically, the name property is read-only in Qt 6. Therefore, you must modify the Constants.qml file to have fonts loaded correctly. You can either remove the FontLoader or switch to using the source property instead of the name property.

To remove the FontLoader, delete the following line from the Constants.qml file:

readonly property FontLoader mySystemFont: FontLoader { name: "Arial" }

Then, remove the following lines that contain references to mySystemFont:

readonly property font font: Qt.font({
                                        family: mySystemFont.name,
                                        pixelSize: Qt.application.font.pixelSize
                                     })

readonly property font largeFont: Qt.font({
                                             family: mySystemFont.name,
                                             pixelSize: Qt.application.font.pixelSize * 1.6
                                         })

Alternatively, you can keep the FontLoader and use the source property instead of the name property. If you are unsure about how to do this, you can replace the Constants.qml file with a new one that you create by using Qt Design Studio 2.2.

Qt Quick Studio Components

Qt Quick Studio Components are available in Qt 6, except for the Iso Icon component. It specifies an icon from an ISO 7000 icon library as a Picture component, which is not supported in Qt 6. Therefore, Iso Icon is also not supported in Qt 6.

Qt Quick Studio Effects

2D Effects are only partially supported. The following 2D effects are not available in Qt 6:

  • Blend
  • Inner Shadow
  • Blur effects except:
    • DirectionalBlur
    • FastBlur
    • GaussianBlur
    • MaskedBlur
    • RecursiveBlur
    • RadialBlur
    • ZoomBlur

Substitutes are provided for the obsolete effects to keep Qt 5 based applications working, but the effects will not be rendered as expected.

Qt Quick 3D

In Qt 6, you cannot use the import import QtQuick3D 1.15, which imports a Qt 5 based Qt Quick 3D module. Qt 6 does not require a version for imports, and therefore it is not used by default. To turn a Qt 5 based project into a Qt 6 based project, you have to adjust the imports in all .qml files that use Qt Quick 3D by removing the version numbers.

For more information about changes in Qt Quick 3D, see the changes file.

QML

For general information about changes in QML between Qt 5 and Qt 6, see:

The most notable change is that Qt 6 does not require a version for imports anymore.

Qt Design Studio

Projects that support only Qt 6 are marked with qt6Project: true in the .qmlproject file. This line is added if you choose Qt 6 in the wizard when creating the project. If the project file does not contain this line, the project will use Qt 5 and a Qt 5 kit by default. You can change this in the project Run Settings, where you can select Qt 6 instead.

Projects that use Qt 6 specific features will not work with Qt 5. This means that projects that are supposed to work with both Qt 5 and Qt 6 require versions for their imports.

Therefore, if you want to use Qt Quick 3D, using the same project with Qt 5 and Qt 6 is not possible.

Available under certain Qt licenses.
Find out more.