aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/qtquick2/plugin.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-04-03 15:54:27 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-04-18 13:59:34 +0000
commit43573c8df170c5662b350703a06537c457c2d2fd (patch)
treee57e2f7235fc51467d2f761ed2753bc5e76ad3c9 /src/imports/qtquick2/plugin.cpp
parent851387d40662cd82ff44a1792825265f82fe7ddf (diff)
Clean up type registration
The QML-specific types need to be registered only for "QtQml". Make sure we don't accidentally add new QML-specific types to QtQuick. We also don't want the base types to be registered under any random URI and version. Formally qmlRegisterBaseTypes() is a public function, but it _really_ should not be called by anyone. Finally, split the types into ones that should belong to QtQml.Models and ones that belong to QtQml proper. Add a plugin that handles QtQml itself rather than using the QQmlEngine ctor for this. [ChangeLog] The accidentally exported function qmlRegisterBaseTypes() was removed. Change-Id: I8bf9f8515e18b016750c721fe694d4cda076780b Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/imports/qtquick2/plugin.cpp')
-rw-r--r--src/imports/qtquick2/plugin.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/imports/qtquick2/plugin.cpp b/src/imports/qtquick2/plugin.cpp
index d73a8b3688..4dc6fee916 100644
--- a/src/imports/qtquick2/plugin.cpp
+++ b/src/imports/qtquick2/plugin.cpp
@@ -38,6 +38,8 @@
****************************************************************************/
#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/private/qqmlengine_p.h>
+#include <QtQml/private/qqmlmodelsmodule_p.h>
#include <private/qtquick2_p.h>
@@ -55,7 +57,14 @@ public:
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick"));
Q_UNUSED(uri);
moduleDefined = true;
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ QQmlEnginePrivate::registerQuickTypes();
+ QQmlModelsModule::registerQuickTypes();
+#endif
QQmlQtQuick2Module::defineModule();
+
+ // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward
+ qmlRegisterModule("QtQuick", 2, QT_VERSION_MINOR);
}
~QtQuick2Plugin() override