From 214fbaa57b73296a0a191b5ff2b1fbc8bf0aaa7a Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 26 Feb 2018 09:16:06 +0100 Subject: add qmlRegisterModule to all QML plugins (QUIP 99) Now it should always be possible to do import QtQuick.Module x.m where x is the module's major version and m is Qt's minor version. [ChangeLog][QtQuick][Important Behavior Changes] In Qt 5.11 and newer versions, QML plugin modules are available with the same minor version as the Qt release minor version number. For example it's possible to import QtQuick.Window 2.11 or import QtQuick.Layouts 1.11 even though there haven't been any API changes in these modules for Qt 5.11, and the maximum possible import version will automatically increment in future Qt versions. This is intended to reduce confusion. Change-Id: I0d28ed04d186bcdd5acde95b8ed0b66c1c4697e3 Reviewed-by: J-P Nurmi --- src/qml/qml/qqmlengine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/qml/qml') diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index ebd354d003..54a7c5130d 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -257,6 +257,9 @@ void QQmlEnginePrivate::defineQtQuick2Module() // register the QtQuick2 types which are implemented in the QtQml module. registerQtQuick2Types("QtQuick",2,0); qmlRegisterUncreatableType("QtQuick", 2, 0, "Locale", QQmlEngine::tr("Locale cannot be instantiated. Use Qt.locale()")); + + // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward + qmlRegisterModule("QtQuick", 2, QT_VERSION_MINOR); } bool QQmlEnginePrivate::designerMode() @@ -956,6 +959,9 @@ void QQmlEnginePrivate::init() registerBaseTypes("QtQml", 2, 0); // import which provides language building blocks. qmlRegisterUncreatableType("QtQml", 2, 2, "Locale", QQmlEngine::tr("Locale cannot be instantiated. Use Qt.locale()")); + // Auto-increment the import to stay in sync with ALL future QtQml minor versions from 5.11 onward + qmlRegisterModule("QtQml", 2, QT_VERSION_MINOR); + QQmlData::init(); baseModulesUninitialized = false; } -- cgit v1.2.3