[Interest] QML: support both Qt5 and Qt6

Shawn Rutledge Shawn.Rutledge at qt.io
Tue Sep 7 22:31:44 CEST 2021


> On 2021 Sep 7, at 22:13, Alexander Dyagilev <alervdvcw at gmail.com> wrote:
> 
> For example, we do use MessageDialog component. In Qt5, it requires import QtQuick.Dialogs 1.3, and in Qt6 - import Qt.labs.platform 1.1.

You can use Qt.labs.platform in both versions.

> Is it possible to import different modules depending on the current Qt version?

You can use different QML files and switch them with QQmlFileSelector; or use some build system technique, like pre-processing, or putting different qml files into resources depending on the version.


More information about the Interest mailing list