diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-07-14 15:48:30 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-07-20 11:07:59 +0000 |
commit | 61159419e3862042e97f01bde944e385313a409c (patch) | |
tree | d5b384fea7066c0b7cdde56a620b46d7fbbea98d | |
parent | d85171a41355b0e26355627db140fbee3fc541b2 (diff) |
Introduce Q_IMPORT_QML_PLUGIN
In Qt 6.2, Q_IMPORT_QML_PLUGIN behaves exactly the same as
Q_IMPORT_PLUGIN. The goal is however to make it obsolete in the future,
by taking care of the plugin handling purely in CMake. The idea is to
have Q_IMPORT_QML_PLUGIN expand to nothing in a later release; having
the additional layer indirection via Q_IMPORT_QML_PLUGIN allows that
change, which would be impossible if we were to directly use
Q_IMPORT_PLUGIN. Having the macro later expand to nothing is required
because otherwise we might attempt to instantiate a static plugin
instance with the same name twice, leading to duplicated symbol errors.
Task-number: QTBUG-95148
Change-Id: I29bf4637f37d6358f07935c476544888c1c4c023
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
(cherry picked from commit 9ac0a380b07c5da0ec0d7224cc8fe5ac21e97676)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/qml/qml/qqmlextensionplugin.cpp | 9 | ||||
-rw-r--r-- | src/qml/qml/qqmlextensionplugin.h | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp index f779199b74..14704a0442 100644 --- a/src/qml/qml/qqmlextensionplugin.cpp +++ b/src/qml/qml/qqmlextensionplugin.cpp @@ -165,6 +165,15 @@ void QQmlEngineExtensionPlugin::initializeEngine(QQmlEngine *engine, const char \inmodule QtQml */ + +/*! + \macro Q_IMPORT_QML_PLUGIN(PluginName) + \relates <QQmlExtensionPlugin> + + Ensures that a QML plugin works in static builds. + \sa Q_IMPORT_PLUGIN +*/ + QT_END_NAMESPACE #include "moc_qqmlextensionplugin.cpp" diff --git a/src/qml/qml/qqmlextensionplugin.h b/src/qml/qml/qqmlextensionplugin.h index 78371106bd..afd58e4032 100644 --- a/src/qml/qml/qqmlextensionplugin.h +++ b/src/qml/qml/qqmlextensionplugin.h @@ -44,6 +44,9 @@ #include <QtCore/QUrl> #include <QtQml/qqmlextensioninterface.h> +#define Q_IMPORT_QML_PLUGIN(PLUGIN) \ + Q_IMPORT_PLUGIN(PLUGIN) + QT_BEGIN_NAMESPACE class QQmlEngine; |