diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2021-01-26 13:48:44 +0100 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2021-02-04 09:29:10 +0100 |
commit | e0c0fd5713c27b1bf9536213cee33494ac734f2d (patch) | |
tree | f671084536a85a19f5d968b0f3c05aa2031d786e /src | |
parent | 5fb34b67b810ca284c216009925f4f38220c4510 (diff) |
QtQuick.Shapes: Make plugin optional
Mark plugin as optional and move out initialization code as to allow use with
the QML compiler.
Change-Id: I4c93168ebd42b6625fbf4c045beac4dcf41aafa6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/shapes/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/imports/shapes/plugin.cpp | 14 | ||||
-rw-r--r-- | src/quickshapes/qquickshape.cpp | 7 | ||||
-rw-r--r-- | src/quickshapes/qquickshape_p.h | 2 |
4 files changed, 15 insertions, 9 deletions
diff --git a/src/imports/shapes/CMakeLists.txt b/src/imports/shapes/CMakeLists.txt index 78f6d9f448..bc25b33e14 100644 --- a/src/imports/shapes/CMakeLists.txt +++ b/src/imports/shapes/CMakeLists.txt @@ -9,6 +9,7 @@ qt_internal_add_qml_module(qmlshapesplugin VERSION "${CMAKE_PROJECT_VERSION}" CLASSNAME QmlShapesPlugin SKIP_TYPE_REGISTRATION + PLUGIN_OPTIONAL SOURCES plugin.cpp PUBLIC_LIBRARIES diff --git a/src/imports/shapes/plugin.cpp b/src/imports/shapes/plugin.cpp index 48eecbd8f1..9a7f5dc77f 100644 --- a/src/imports/shapes/plugin.cpp +++ b/src/imports/shapes/plugin.cpp @@ -43,23 +43,19 @@ QT_BEGIN_NAMESPACE -class QmlShapesPlugin : public QQmlExtensionPlugin +class QmlShapesPlugin : public QQmlEngineExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) public: QmlShapesPlugin(QObject *parent = nullptr) - : QQmlExtensionPlugin(parent) + : QQmlEngineExtensionPlugin(parent) { volatile auto registration = &qml_register_types_QtQuick_Shapes; + volatile auto initialize = &QQuickShapes_initializeModule; Q_UNUSED(registration); - } - - void registerTypes(const char *uri) override - { - Q_UNUSED(uri); - QQuickShapesModule::defineModule(); + Q_UNUSED(initialize); } }; diff --git a/src/quickshapes/qquickshape.cpp b/src/quickshapes/qquickshape.cpp index 6f1087737b..50e995f07e 100644 --- a/src/quickshapes/qquickshape.cpp +++ b/src/quickshapes/qquickshape.cpp @@ -72,6 +72,13 @@ Q_LOGGING_CATEGORY(QQSHAPE_LOG_TIME_DIRTY_SYNC, "qt.shape.time.sync") \endqml */ +void QQuickShapes_initializeModule() +{ + QQuickShapesModule::defineModule(); +} + +Q_CONSTRUCTOR_FUNCTION(QQuickShapes_initializeModule) + void QQuickShapesModule::defineModule() { initResources(); diff --git a/src/quickshapes/qquickshape_p.h b/src/quickshapes/qquickshape_p.h index ca72c628c5..85d6c3231b 100644 --- a/src/quickshapes/qquickshape_p.h +++ b/src/quickshapes/qquickshape_p.h @@ -63,6 +63,8 @@ QT_BEGIN_NAMESPACE class QQuickShapePathPrivate; class QQuickShapePrivate; +void Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapes_initializeModule(); + class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapesModule { public: |