diff options
| author | Maximilian Goldstein <max.goldstein@qt.io> | 2022-08-03 12:20:26 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-11-28 14:11:21 +0100 |
| commit | 46429839fedd79244559069bb4235a8b0e7ebf0a (patch) | |
| tree | 849874ae236f954dea3a5db294d60a4e87f526d5 | |
| parent | e11c1eda4fbd1910f9089dae60e4d22bfe3bb595 (diff) | |
QtQml: Restructure the module
Create a new module QtQml.Base which contains the actual QtQml types
and a new module QtQml that just imports QtQml.Base, WorkerScript and
Models. This is so we don't have circular dependencies within QtQml
anymore where QtQml imports QtQml.Models but Models can't depend on
QtQml for type information.
[ChangeLog][QtQml][Important Behavior Changes] If you import QtQml you
now need to make sure that QtQml is actually in the import path. Usually
this is the case, but by manipulating the import path you can hide
QtQml. In previous versions of Qt you could then still import QtQml
because its types are present in the QtQml library. However, it would
ignore its dependencies: QtQml.Models and QtQml.WorkerScript. If you
really want to import only the builtins, you can always "import QML".
Fixes: QTBUG-105240
Change-Id: Icdcdcc926757a8e9e8d639301b5b6d110de59613
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
23 files changed, 320 insertions, 99 deletions
diff --git a/src/qml/CMakeLists.txt b/src/qml/CMakeLists.txt index 24c18daef5..5781b03573 100644 --- a/src/qml/CMakeLists.txt +++ b/src/qml/CMakeLists.txt @@ -32,13 +32,12 @@ if(ANDROID) endif() qt_internal_add_qml_module(Qml - URI "QtQml" + URI "QtQml.Base" VERSION "${PROJECT_VERSION}" DESIGNER_SUPPORTED __QT_INTERNAL_SYSTEM_MODULE PLUGIN_TARGET qmlplugin CLASS_NAME QtQmlPlugin - IMPORTS ${module_dynamic_qml_imports} PLUGIN_TYPES qmltooling SOURCES ../3rdparty/masm/assembler/ARM64Assembler.h @@ -294,6 +293,7 @@ qt_internal_add_qml_module(Qml qml/qqmllist.cpp qml/qqmllist.h qml/qqmllist_p.h qml/qqmllistwrapper.cpp qml/qqmllistwrapper_p.h qml/qqmlloggingcategory.cpp qml/qqmlloggingcategory_p.h + qml/qqmlmetamoduleregistration.cpp qml/qqmlmetaobject.cpp qml/qqmlmetaobject_p.h qml/qqmlmetatype.cpp qml/qqmlmetatype_p.h qml/qqmlmetatypedata.cpp qml/qqmlmetatypedata_p.h @@ -419,6 +419,35 @@ qt_internal_add_qml_module(Qml GENERATE_PRIVATE_CPP_EXPORTS ) +qt_internal_add_qml_module(QmlMeta + URI "QtQml" + VERSION "${PROJECT_VERSION}" + DESIGNER_SUPPORTED + CLASS_NAME QtQmlMetaPlugin + PLUGIN_TARGET QmlMeta + + # Prevent type registration + NO_GENERATE_QMLTYPES + + PAST_MAJOR_VERSIONS 2 + IMPORTS + QtQml.Base/auto + ${module_dynamic_qml_imports} +) + +# Add the QtQml qmldir to libQtQml, too. +# Since we also provide the (bare bones) type registration in libQtQml, +# this makes the complete module reside in libQtQml. There is no need to +# load the QmlMeta plugin, then. +# Se still provide the plugin so that static linking works. +get_target_property(qtqml_out_dir QmlMeta QT_QML_MODULE_OUTPUT_DIRECTORY) +qt_internal_add_resource(Qml "qmlMetaQmldir" + PREFIX + "/qt-project.org/imports/QtQml" + FILES + ${qtqml_out_dir}/qmldir +) + # Linking to the static qml plugin should also automatically link to the worker script # static plugin otherwise you get errors like # module "QtQml.WorkerScript" plugin "workerscriptplugin" not found diff --git a/src/qml/qml/qqmlmetamoduleregistration.cpp b/src/qml/qml/qqmlmetamoduleregistration.cpp new file mode 100644 index 0000000000..280c7a7c8d --- /dev/null +++ b/src/qml/qml/qqmlmetamoduleregistration.cpp @@ -0,0 +1,26 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include <private/qtqmlglobal_p.h> +#include <qqmlmoduleregistration.h> +#include <qqml.h> + +QT_BEGIN_NAMESPACE + +// Provide the type registration for QtQml here, in libQtQml.so. +// This way we get a completely functional QtQml module and don't have to +// rely on the plugin to be loaded. +// In CMakeLists.txt we've specified NO_GENERATE_QMLTYPES to prevent +// the generation of an extra type registration file. +Q_QML_PRIVATE_EXPORT void qml_register_types_QtQml() +{ + // ### Qt7: Handle version 6 like version 2. + qmlRegisterModule("QtQml", 2, 0); + qmlRegisterModule("QtQml", 2, 254); + qmlRegisterModule("QtQml", QT_VERSION_MAJOR, 0); + qmlRegisterModule("QtQml", QT_VERSION_MAJOR, QT_VERSION_MINOR); +} + +static const QQmlModuleRegistration registration("QtQml", qml_register_types_QtQml); + +QT_END_NAMESPACE diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 9636fc8739..ada670a155 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -647,18 +647,19 @@ bool QQmlTypeLoader::Blob::addLibraryImport(const QQmlTypeLoader::Blob::PendingI return false; } - if ( + // If there is a qmldir we cannot see, yet, then we have to wait. + // The qmldir might contain import directives. + if (qmldirResult != QQmlImportDatabase::QmldirInterceptedToRemote && ( // Major version of module already registered: // We believe that the registration is complete. QQmlMetaType::typeModule(import->uri, import->version) // Otherwise, try to register further module types. - || (qmldirResult != QQmlImportDatabase::QmldirInterceptedToRemote - && QQmlMetaType::qmlRegisterModuleTypes(import->uri)) + || QQmlMetaType::qmlRegisterModuleTypes(import->uri) // Otherwise, there is no way to register any further types. // Try with any module of that name. - || QQmlMetaType::latestModuleVersion(import->uri).isValid()) { + || QQmlMetaType::latestModuleVersion(import->uri).isValid())) { if (!m_importCache->addLibraryImport( importDatabase, import->uri, import->qualifier, import->version, diff --git a/src/qmlmodels/CMakeLists.txt b/src/qmlmodels/CMakeLists.txt index 910bbe47de..b3875a8091 100644 --- a/src/qmlmodels/CMakeLists.txt +++ b/src/qmlmodels/CMakeLists.txt @@ -11,6 +11,8 @@ qt_internal_add_qml_module(QmlModels DESIGNER_SUPPORTED PLUGIN_TARGET modelsplugin CLASS_NAME QtQmlModelsPlugin + DEPENDENCIES + QtQml.Base/auto SOURCES qqmlchangeset.cpp qqmlchangeset_p.h qqmlmodelsmodule.cpp qqmlmodelsmodule_p.h diff --git a/src/qmlworkerscript/CMakeLists.txt b/src/qmlworkerscript/CMakeLists.txt index 5d6151112e..2bf6f205e2 100644 --- a/src/qmlworkerscript/CMakeLists.txt +++ b/src/qmlworkerscript/CMakeLists.txt @@ -11,6 +11,8 @@ qt_internal_add_qml_module(QmlWorkerScript DESIGNER_SUPPORTED PLUGIN_TARGET workerscriptplugin CLASS_NAME QtQmlWorkerScriptPlugin + DEPENDENCIES + QtQml.Base/auto SOURCES qquickworkerscript.cpp qquickworkerscript_p.h qtqmlworkerscriptglobal.h qtqmlworkerscriptglobal_p.h diff --git a/tests/auto/qml/qmlimportscanner/data/CompositeSingleton.json b/tests/auto/qml/qmlimportscanner/data/CompositeSingleton.json index 98fc52b292..a688511ed0 100644 --- a/tests/auto/qml/qmlimportscanner/data/CompositeSingleton.json +++ b/tests/auto/qml/qmlimportscanner/data/CompositeSingleton.json @@ -12,17 +12,27 @@ "pluginIsOptional": true, "relativePath": "QtQuick", "type": "module", - "prefer":":/qt-project.org/imports/QtQuick/" + "prefer": ":/qt-project.org/imports/QtQuick/" + }, + { + "classname": "QtQmlMetaPlugin", + "linkTarget": "Qt6::QmlMeta", + "name": "QtQml", + "plugin": "qmlmetaplugin", + "pluginIsOptional": true, + "relativePath": "QtQml", + "type": "module", + "prefer": ":/qt-project.org/imports/QtQml/" }, { "classname": "QtQmlPlugin", "linkTarget": "Qt6::qmlplugin", - "name": "QtQml", + "name": "QtQml.Base", "plugin": "qmlplugin", "pluginIsOptional": true, - "relativePath": "QtQml", + "relativePath": "QtQml/Base", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/" + "prefer": ":/qt-project.org/imports/QtQml/Base/" }, { "classname": "QtQmlModelsPlugin", @@ -32,7 +42,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/Models", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/Models/" + "prefer": ":/qt-project.org/imports/QtQml/Models/" }, { "classname": "QtQmlWorkerScriptPlugin", @@ -42,6 +52,6 @@ "pluginIsOptional": true, "relativePath": "QtQml/WorkerScript", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/WorkerScript/" + "prefer": ":/qt-project.org/imports/QtQml/WorkerScript/" } ] diff --git a/tests/auto/qml/qmlimportscanner/data/CompositeWithEnum.json b/tests/auto/qml/qmlimportscanner/data/CompositeWithEnum.json index 23d354e620..084e4354b3 100644 --- a/tests/auto/qml/qmlimportscanner/data/CompositeWithEnum.json +++ b/tests/auto/qml/qmlimportscanner/data/CompositeWithEnum.json @@ -5,14 +5,24 @@ "type": "module" }, { + "classname": "QtQmlMetaPlugin", + "linkTarget": "Qt6::QmlMeta", + "name": "QtQml", + "plugin": "qmlmetaplugin", + "pluginIsOptional": true, + "relativePath": "QtQml", + "type": "module", + "prefer": ":/qt-project.org/imports/QtQml/" + }, + { "classname": "QtQmlPlugin", "linkTarget": "Qt6::qmlplugin", - "name": "QtQml", + "name": "QtQml.Base", "plugin": "qmlplugin", "pluginIsOptional": true, - "relativePath": "QtQml", + "relativePath": "QtQml/Base", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/" + "prefer": ":/qt-project.org/imports/QtQml/Base/" }, { "classname": "QtQmlModelsPlugin", @@ -22,7 +32,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/Models", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/Models/" + "prefer": ":/qt-project.org/imports/QtQml/Models/" }, { "classname": "QtQmlWorkerScriptPlugin", @@ -32,6 +42,6 @@ "pluginIsOptional": true, "relativePath": "QtQml/WorkerScript", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/WorkerScript/" + "prefer": ":/qt-project.org/imports/QtQml/WorkerScript/" } ] diff --git a/tests/auto/qml/qmlimportscanner/data/CompositeWithinSingleton.json b/tests/auto/qml/qmlimportscanner/data/CompositeWithinSingleton.json index 55653f5794..c50fe5ab51 100644 --- a/tests/auto/qml/qmlimportscanner/data/CompositeWithinSingleton.json +++ b/tests/auto/qml/qmlimportscanner/data/CompositeWithinSingleton.json @@ -12,17 +12,27 @@ "pluginIsOptional": true, "relativePath": "QtQuick", "type": "module", - "prefer":":/qt-project.org/imports/QtQuick/" + "prefer": ":/qt-project.org/imports/QtQuick/" + }, + { + "classname": "QtQmlMetaPlugin", + "linkTarget": "Qt6::QmlMeta", + "name": "QtQml", + "plugin": "qmlmetaplugin", + "pluginIsOptional": true, + "relativePath": "QtQml", + "type": "module", + "prefer": ":/qt-project.org/imports/QtQml/" }, { "classname": "QtQmlPlugin", "linkTarget": "Qt6::qmlplugin", - "name": "QtQml", + "name": "QtQml.Base", "plugin": "qmlplugin", "pluginIsOptional": true, - "relativePath": "QtQml", + "relativePath": "QtQml/Base", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/" + "prefer": ":/qt-project.org/imports/QtQml/Base/" }, { "classname": "QtQmlModelsPlugin", @@ -32,7 +42,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/Models", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/Models/" + "prefer": ":/qt-project.org/imports/QtQml/Models/" }, { "classname": "QtQmlWorkerScriptPlugin", @@ -42,6 +52,6 @@ "pluginIsOptional": true, "relativePath": "QtQml/WorkerScript", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/WorkerScript/" + "prefer": ":/qt-project.org/imports/QtQml/WorkerScript/" } ] diff --git a/tests/auto/qml/qmlimportscanner/data/Drawer.qml.json b/tests/auto/qml/qmlimportscanner/data/Drawer.qml.json index d8e972002d..447c664785 100644 --- a/tests/auto/qml/qmlimportscanner/data/Drawer.qml.json +++ b/tests/auto/qml/qmlimportscanner/data/Drawer.qml.json @@ -1,13 +1,23 @@ [ { + "classname": "QtQmlMetaPlugin", + "linkTarget": "Qt6::QmlMeta", + "name": "QtQml", + "plugin": "qmlmetaplugin", + "pluginIsOptional": true, + "relativePath": "QtQml", + "type": "module", + "prefer": ":/qt-project.org/imports/QtQml/" + }, + { "classname": "QtQmlPlugin", "linkTarget": "Qt6::qmlplugin", - "name": "QtQml", + "name": "QtQml.Base", "plugin": "qmlplugin", "pluginIsOptional": true, - "relativePath": "QtQml", + "relativePath": "QtQml/Base", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/" + "prefer": ":/qt-project.org/imports/QtQml/Base/" }, { "classname": "QtQmlModelsPlugin", @@ -17,7 +27,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/Models", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/Models/" + "prefer": ":/qt-project.org/imports/QtQml/Models/" }, { "classname": "QtQmlWorkerScriptPlugin", @@ -27,6 +37,6 @@ "pluginIsOptional": true, "relativePath": "QtQml/WorkerScript", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/WorkerScript/" + "prefer": ":/qt-project.org/imports/QtQml/WorkerScript/" } ] diff --git a/tests/auto/qml/qmlimportscanner/data/Imports.json b/tests/auto/qml/qmlimportscanner/data/Imports.json index 638519d689..5e23e7b1ad 100644 --- a/tests/auto/qml/qmlimportscanner/data/Imports.json +++ b/tests/auto/qml/qmlimportscanner/data/Imports.json @@ -12,17 +12,27 @@ "pluginIsOptional": true, "relativePath": "QtQuick", "type": "module", - "prefer":":/qt-project.org/imports/QtQuick/" + "prefer": ":/qt-project.org/imports/QtQuick/" + }, + { + "classname": "QtQmlMetaPlugin", + "linkTarget": "Qt6::QmlMeta", + "name": "QtQml", + "plugin": "qmlmetaplugin", + "pluginIsOptional": true, + "relativePath": "QtQml", + "type": "module", + "prefer": ":/qt-project.org/imports/QtQml/" }, { "classname": "QtQmlPlugin", "linkTarget": "Qt6::qmlplugin", - "name": "QtQml", + "name": "QtQml.Base", "plugin": "qmlplugin", "pluginIsOptional": true, - "relativePath": "QtQml", + "relativePath": "QtQml/Base", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/" + "prefer": ":/qt-project.org/imports/QtQml/Base/" }, { "classname": "QtQmlModelsPlugin", @@ -32,7 +42,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/Models", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/Models/" + "prefer": ":/qt-project.org/imports/QtQml/Models/" }, { "classname": "QtQmlWorkerScriptPlugin", @@ -42,6 +52,6 @@ "pluginIsOptional": true, "relativePath": "QtQml/WorkerScript", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/WorkerScript/" + "prefer": ":/qt-project.org/imports/QtQml/WorkerScript/" } ] diff --git a/tests/auto/qml/qmlimportscanner/data/ListProperty.qml.json b/tests/auto/qml/qmlimportscanner/data/ListProperty.qml.json index 9815ca8e92..06df9295fe 100644 --- a/tests/auto/qml/qmlimportscanner/data/ListProperty.qml.json +++ b/tests/auto/qml/qmlimportscanner/data/ListProperty.qml.json @@ -7,7 +7,7 @@ "pluginIsOptional": true, "relativePath": "QtQuick", "type": "module", - "prefer":":/qt-project.org/imports/QtQuick/" + "prefer": ":/qt-project.org/imports/QtQuick/" }, { "name": "Things", @@ -16,14 +16,24 @@ "type": "module" }, { + "classname": "QtQmlMetaPlugin", + "linkTarget": "Qt6::QmlMeta", + "name": "QtQml", + "plugin": "qmlmetaplugin", + "pluginIsOptional": true, + "relativePath": "QtQml", + "type": "module", + "prefer": ":/qt-project.org/imports/QtQml/" + }, + { "classname": "QtQmlPlugin", "linkTarget": "Qt6::qmlplugin", - "name": "QtQml", + "name": "QtQml.Base", "plugin": "qmlplugin", "pluginIsOptional": true, - "relativePath": "QtQml", + "relativePath": "QtQml/Base", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/" + "prefer": ":/qt-project.org/imports/QtQml/Base/" }, { "classname": "QtQmlModelsPlugin", @@ -33,7 +43,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/Models", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/Models/" + "prefer": ":/qt-project.org/imports/QtQml/Models/" }, { "classname": "QtQmlWorkerScriptPlugin", @@ -43,6 +53,6 @@ "pluginIsOptional": true, "relativePath": "QtQml/WorkerScript", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/WorkerScript/" + "prefer": ":/qt-project.org/imports/QtQml/WorkerScript/" } ] diff --git a/tests/auto/qml/qmlimportscanner/data/QTBUG-45916.js.json b/tests/auto/qml/qmlimportscanner/data/QTBUG-45916.js.json index 48531c59cb..213798d04d 100644 --- a/tests/auto/qml/qmlimportscanner/data/QTBUG-45916.js.json +++ b/tests/auto/qml/qmlimportscanner/data/QTBUG-45916.js.json @@ -7,17 +7,27 @@ "pluginIsOptional": true, "relativePath": "QtQuick", "type": "module", - "prefer":":/qt-project.org/imports/QtQuick/" + "prefer": ":/qt-project.org/imports/QtQuick/" + }, + { + "classname": "QtQmlMetaPlugin", + "linkTarget": "Qt6::QmlMeta", + "name": "QtQml", + "plugin": "qmlmetaplugin", + "pluginIsOptional": true, + "relativePath": "QtQml", + "type": "module", + "prefer": ":/qt-project.org/imports/QtQml/" }, { "classname": "QtQmlPlugin", "linkTarget": "Qt6::qmlplugin", - "name": "QtQml", + "name": "QtQml.Base", "plugin": "qmlplugin", "pluginIsOptional": true, - "relativePath": "QtQml", + "relativePath": "QtQml/Base", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/" + "prefer": ":/qt-project.org/imports/QtQml/Base/" }, { "classname": "QtQmlModelsPlugin", @@ -27,7 +37,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/Models", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/Models/" + "prefer": ":/qt-project.org/imports/QtQml/Models/" }, { "classname": "QtQmlWorkerScriptPlugin", @@ -37,6 +47,6 @@ "pluginIsOptional": true, "relativePath": "QtQml/WorkerScript", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/WorkerScript/" + "prefer": ":/qt-project.org/imports/QtQml/WorkerScript/" } ] diff --git a/tests/auto/qml/qmlimportscanner/data/Simple.qml.json b/tests/auto/qml/qmlimportscanner/data/Simple.qml.json index 48531c59cb..213798d04d 100644 --- a/tests/auto/qml/qmlimportscanner/data/Simple.qml.json +++ b/tests/auto/qml/qmlimportscanner/data/Simple.qml.json @@ -7,17 +7,27 @@ "pluginIsOptional": true, "relativePath": "QtQuick", "type": "module", - "prefer":":/qt-project.org/imports/QtQuick/" + "prefer": ":/qt-project.org/imports/QtQuick/" + }, + { + "classname": "QtQmlMetaPlugin", + "linkTarget": "Qt6::QmlMeta", + "name": "QtQml", + "plugin": "qmlmetaplugin", + "pluginIsOptional": true, + "relativePath": "QtQml", + "type": "module", + "prefer": ":/qt-project.org/imports/QtQml/" }, { "classname": "QtQmlPlugin", "linkTarget": "Qt6::qmlplugin", - "name": "QtQml", + "name": "QtQml.Base", "plugin": "qmlplugin", "pluginIsOptional": true, - "relativePath": "QtQml", + "relativePath": "QtQml/Base", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/" + "prefer": ":/qt-project.org/imports/QtQml/Base/" }, { "classname": "QtQmlModelsPlugin", @@ -27,7 +37,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/Models", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/Models/" + "prefer": ":/qt-project.org/imports/QtQml/Models/" }, { "classname": "QtQmlWorkerScriptPlugin", @@ -37,6 +47,6 @@ "pluginIsOptional": true, "relativePath": "QtQml/WorkerScript", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/WorkerScript/" + "prefer": ":/qt-project.org/imports/QtQml/WorkerScript/" } ] diff --git a/tests/auto/qml/qmlimportscanner/data/Singleton.json b/tests/auto/qml/qmlimportscanner/data/Singleton.json index a1a5f3a129..cb24e57f60 100644 --- a/tests/auto/qml/qmlimportscanner/data/Singleton.json +++ b/tests/auto/qml/qmlimportscanner/data/Singleton.json @@ -12,17 +12,27 @@ "pluginIsOptional": true, "relativePath": "QtQuick", "type": "module", - "prefer":":/qt-project.org/imports/QtQuick/" + "prefer": ":/qt-project.org/imports/QtQuick/" + }, + { + "classname": "QtQmlMetaPlugin", + "linkTarget": "Qt6::QmlMeta", + "name": "QtQml", + "plugin": "qmlmetaplugin", + "pluginIsOptional": true, + "relativePath": "QtQml", + "type": "module", + "prefer": ":/qt-project.org/imports/QtQml/" }, { "classname": "QtQmlPlugin", "linkTarget": "Qt6::qmlplugin", - "name": "QtQml", + "name": "QtQml.Base", "plugin": "qmlplugin", "pluginIsOptional": true, - "relativePath": "QtQml", + "relativePath": "QtQml/Base", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/" + "prefer": ":/qt-project.org/imports/QtQml/Base/" }, { "classname": "QtQmlModelsPlugin", @@ -32,7 +42,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/Models", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/Models/" + "prefer": ":/qt-project.org/imports/QtQml/Models/" }, { "classname": "QtQmlWorkerScriptPlugin", @@ -42,6 +52,6 @@ "pluginIsOptional": true, "relativePath": "QtQml/WorkerScript", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/WorkerScript/" + "prefer": ":/qt-project.org/imports/QtQml/WorkerScript/" } ] diff --git a/tests/auto/qml/qmlimportscanner/data/Things.json b/tests/auto/qml/qmlimportscanner/data/Things.json index 7a70e49c3a..ee5caecfda 100644 --- a/tests/auto/qml/qmlimportscanner/data/Things.json +++ b/tests/auto/qml/qmlimportscanner/data/Things.json @@ -13,17 +13,27 @@ "pluginIsOptional": true, "relativePath": "QtQuick", "type": "module", - "prefer":":/qt-project.org/imports/QtQuick/" + "prefer": ":/qt-project.org/imports/QtQuick/" + }, + { + "classname": "QtQmlMetaPlugin", + "linkTarget": "Qt6::QmlMeta", + "name": "QtQml", + "plugin": "qmlmetaplugin", + "pluginIsOptional": true, + "relativePath": "QtQml", + "type": "module", + "prefer": ":/qt-project.org/imports/QtQml/" }, { "classname": "QtQmlPlugin", "linkTarget": "Qt6::qmlplugin", - "name": "QtQml", + "name": "QtQml.Base", "plugin": "qmlplugin", "pluginIsOptional": true, - "relativePath": "QtQml", + "relativePath": "QtQml/Base", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/" + "prefer": ":/qt-project.org/imports/QtQml/Base/" }, { "classname": "QtQmlModelsPlugin", @@ -33,7 +43,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/Models", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/Models/" + "prefer": ":/qt-project.org/imports/QtQml/Models/" }, { "classname": "QtQmlWorkerScriptPlugin", @@ -43,6 +53,6 @@ "pluginIsOptional": true, "relativePath": "QtQml/WorkerScript", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/WorkerScript/" + "prefer": ":/qt-project.org/imports/QtQml/WorkerScript/" } ] diff --git a/tests/auto/qml/qmlimportscanner/data/javascriptMethods.qml.json b/tests/auto/qml/qmlimportscanner/data/javascriptMethods.qml.json index adde17e8d5..2d2b602fb1 100644 --- a/tests/auto/qml/qmlimportscanner/data/javascriptMethods.qml.json +++ b/tests/auto/qml/qmlimportscanner/data/javascriptMethods.qml.json @@ -1,13 +1,23 @@ [ { + "classname": "QtQmlMetaPlugin", + "linkTarget": "Qt6::QmlMeta", + "name": "QtQml", + "plugin": "qmlmetaplugin", + "pluginIsOptional": true, + "relativePath": "QtQml", + "type": "module", + "prefer": ":/qt-project.org/imports/QtQml/" + }, + { "classname": "QtQmlPlugin", "linkTarget": "Qt6::qmlplugin", - "name": "QtQml", + "name": "QtQml.Base", "plugin": "qmlplugin", "pluginIsOptional": true, - "relativePath": "QtQml", + "relativePath": "QtQml/Base", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/" + "prefer": ":/qt-project.org/imports/QtQml/Base/" }, { "name": "Methods.js", @@ -21,7 +31,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/Models", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/Models/" + "prefer": ":/qt-project.org/imports/QtQml/Models/" }, { "classname": "QtQmlWorkerScriptPlugin", @@ -31,6 +41,6 @@ "pluginIsOptional": true, "relativePath": "QtQml/WorkerScript", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/WorkerScript/" + "prefer": ":/qt-project.org/imports/QtQml/WorkerScript/" } ] diff --git a/tests/auto/qml/qmlimportscanner/data/localImport.qml.json b/tests/auto/qml/qmlimportscanner/data/localImport.qml.json index 7a70e49c3a..ee5caecfda 100644 --- a/tests/auto/qml/qmlimportscanner/data/localImport.qml.json +++ b/tests/auto/qml/qmlimportscanner/data/localImport.qml.json @@ -13,17 +13,27 @@ "pluginIsOptional": true, "relativePath": "QtQuick", "type": "module", - "prefer":":/qt-project.org/imports/QtQuick/" + "prefer": ":/qt-project.org/imports/QtQuick/" + }, + { + "classname": "QtQmlMetaPlugin", + "linkTarget": "Qt6::QmlMeta", + "name": "QtQml", + "plugin": "qmlmetaplugin", + "pluginIsOptional": true, + "relativePath": "QtQml", + "type": "module", + "prefer": ":/qt-project.org/imports/QtQml/" }, { "classname": "QtQmlPlugin", "linkTarget": "Qt6::qmlplugin", - "name": "QtQml", + "name": "QtQml.Base", "plugin": "qmlplugin", "pluginIsOptional": true, - "relativePath": "QtQml", + "relativePath": "QtQml/Base", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/" + "prefer": ":/qt-project.org/imports/QtQml/Base/" }, { "classname": "QtQmlModelsPlugin", @@ -33,7 +43,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/Models", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/Models/" + "prefer": ":/qt-project.org/imports/QtQml/Models/" }, { "classname": "QtQmlWorkerScriptPlugin", @@ -43,6 +53,6 @@ "pluginIsOptional": true, "relativePath": "QtQml/WorkerScript", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/WorkerScript/" + "prefer": ":/qt-project.org/imports/QtQml/WorkerScript/" } ] diff --git a/tests/auto/qml/qmlimportscanner/data/parentEnum.qml.json b/tests/auto/qml/qmlimportscanner/data/parentEnum.qml.json index 48531c59cb..213798d04d 100644 --- a/tests/auto/qml/qmlimportscanner/data/parentEnum.qml.json +++ b/tests/auto/qml/qmlimportscanner/data/parentEnum.qml.json @@ -7,17 +7,27 @@ "pluginIsOptional": true, "relativePath": "QtQuick", "type": "module", - "prefer":":/qt-project.org/imports/QtQuick/" + "prefer": ":/qt-project.org/imports/QtQuick/" + }, + { + "classname": "QtQmlMetaPlugin", + "linkTarget": "Qt6::QmlMeta", + "name": "QtQml", + "plugin": "qmlmetaplugin", + "pluginIsOptional": true, + "relativePath": "QtQml", + "type": "module", + "prefer": ":/qt-project.org/imports/QtQml/" }, { "classname": "QtQmlPlugin", "linkTarget": "Qt6::qmlplugin", - "name": "QtQml", + "name": "QtQml.Base", "plugin": "qmlplugin", "pluginIsOptional": true, - "relativePath": "QtQml", + "relativePath": "QtQml/Base", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/" + "prefer": ":/qt-project.org/imports/QtQml/Base/" }, { "classname": "QtQmlModelsPlugin", @@ -27,7 +37,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/Models", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/Models/" + "prefer": ":/qt-project.org/imports/QtQml/Models/" }, { "classname": "QtQmlWorkerScriptPlugin", @@ -37,6 +47,6 @@ "pluginIsOptional": true, "relativePath": "QtQml/WorkerScript", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/WorkerScript/" + "prefer": ":/qt-project.org/imports/QtQml/WorkerScript/" } ] diff --git a/tests/auto/qml/qmlimportscanner/data/qmldirImportAndDepend.qml.json b/tests/auto/qml/qmlimportscanner/data/qmldirImportAndDepend.qml.json index 7a70e49c3a..ee5caecfda 100644 --- a/tests/auto/qml/qmlimportscanner/data/qmldirImportAndDepend.qml.json +++ b/tests/auto/qml/qmlimportscanner/data/qmldirImportAndDepend.qml.json @@ -13,17 +13,27 @@ "pluginIsOptional": true, "relativePath": "QtQuick", "type": "module", - "prefer":":/qt-project.org/imports/QtQuick/" + "prefer": ":/qt-project.org/imports/QtQuick/" + }, + { + "classname": "QtQmlMetaPlugin", + "linkTarget": "Qt6::QmlMeta", + "name": "QtQml", + "plugin": "qmlmetaplugin", + "pluginIsOptional": true, + "relativePath": "QtQml", + "type": "module", + "prefer": ":/qt-project.org/imports/QtQml/" }, { "classname": "QtQmlPlugin", "linkTarget": "Qt6::qmlplugin", - "name": "QtQml", + "name": "QtQml.Base", "plugin": "qmlplugin", "pluginIsOptional": true, - "relativePath": "QtQml", + "relativePath": "QtQml/Base", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/" + "prefer": ":/qt-project.org/imports/QtQml/Base/" }, { "classname": "QtQmlModelsPlugin", @@ -33,7 +43,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/Models", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/Models/" + "prefer": ":/qt-project.org/imports/QtQml/Models/" }, { "classname": "QtQmlWorkerScriptPlugin", @@ -43,6 +53,6 @@ "pluginIsOptional": true, "relativePath": "QtQml/WorkerScript", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/WorkerScript/" + "prefer": ":/qt-project.org/imports/QtQml/WorkerScript/" } ] diff --git a/tests/auto/qml/qmlimportscanner/data/qtQmlOnly.qml.json b/tests/auto/qml/qmlimportscanner/data/qtQmlOnly.qml.json index d8e972002d..447c664785 100644 --- a/tests/auto/qml/qmlimportscanner/data/qtQmlOnly.qml.json +++ b/tests/auto/qml/qmlimportscanner/data/qtQmlOnly.qml.json @@ -1,13 +1,23 @@ [ { + "classname": "QtQmlMetaPlugin", + "linkTarget": "Qt6::QmlMeta", + "name": "QtQml", + "plugin": "qmlmetaplugin", + "pluginIsOptional": true, + "relativePath": "QtQml", + "type": "module", + "prefer": ":/qt-project.org/imports/QtQml/" + }, + { "classname": "QtQmlPlugin", "linkTarget": "Qt6::qmlplugin", - "name": "QtQml", + "name": "QtQml.Base", "plugin": "qmlplugin", "pluginIsOptional": true, - "relativePath": "QtQml", + "relativePath": "QtQml/Base", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/" + "prefer": ":/qt-project.org/imports/QtQml/Base/" }, { "classname": "QtQmlModelsPlugin", @@ -17,7 +27,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/Models", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/Models/" + "prefer": ":/qt-project.org/imports/QtQml/Models/" }, { "classname": "QtQmlWorkerScriptPlugin", @@ -27,6 +37,6 @@ "pluginIsOptional": true, "relativePath": "QtQml/WorkerScript", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/WorkerScript/" + "prefer": ":/qt-project.org/imports/QtQml/WorkerScript/" } ] diff --git a/tests/auto/qml/qmlimportscanner/data/rootPath.json b/tests/auto/qml/qmlimportscanner/data/rootPath.json index efb3ca8244..942c8d6000 100644 --- a/tests/auto/qml/qmlimportscanner/data/rootPath.json +++ b/tests/auto/qml/qmlimportscanner/data/rootPath.json @@ -7,17 +7,27 @@ "pluginIsOptional": true, "relativePath": "QtQuick", "type": "module", - "prefer":":/qt-project.org/imports/QtQuick/" + "prefer": ":/qt-project.org/imports/QtQuick/" + }, + { + "classname": "QtQmlMetaPlugin", + "linkTarget": "Qt6::QmlMeta", + "name": "QtQml", + "plugin": "qmlmetaplugin", + "pluginIsOptional": true, + "relativePath": "QtQml", + "type": "module", + "prefer": ":/qt-project.org/imports/QtQml/" }, { "classname": "QtQmlPlugin", "linkTarget": "Qt6::qmlplugin", - "name": "QtQml", + "name": "QtQml.Base", "plugin": "qmlplugin", "pluginIsOptional": true, - "relativePath": "QtQml", + "relativePath": "QtQml/Base", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/" + "prefer": ":/qt-project.org/imports/QtQml/Base/" }, { "classname": "QtQmlModelsPlugin", @@ -27,7 +37,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/Models", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/Models/" + "prefer": ":/qt-project.org/imports/QtQml/Models/" }, { "classname": "QtQmlWorkerScriptPlugin", @@ -37,7 +47,7 @@ "pluginIsOptional": true, "relativePath": "QtQml/WorkerScript", "type": "module", - "prefer":":/qt-project.org/imports/QtQml/WorkerScript/" + "prefer": ":/qt-project.org/imports/QtQml/WorkerScript/" }, { "name": "QTBUG-45916.js", diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index 8a15cf906a..991af073fb 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -904,6 +904,7 @@ void tst_qqmlengine::qtqmlModule() QQmlEngine e; QQmlComponent c(&e, testFile); if (expectedError.isEmpty()) { + QVERIFY2(c.isReady(), qPrintable(c.errorString())); QScopedPointer<QObject> o(c.create()); QVERIFY(o); } else { diff --git a/tests/auto/qml/qqmlmoduleplugin/imports/ModuleFromQrc/Foo.qml b/tests/auto/qml/qqmlmoduleplugin/imports/ModuleFromQrc/Foo.qml index 54531c4bdc..842183ed5b 100644 --- a/tests/auto/qml/qqmlmoduleplugin/imports/ModuleFromQrc/Foo.qml +++ b/tests/auto/qml/qqmlmoduleplugin/imports/ModuleFromQrc/Foo.qml @@ -1,2 +1,2 @@ -import QtQml +import QML QtObject {} |
