diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-08-22 16:36:42 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-01-10 18:01:27 +0100 |
commit | 1cd494fbfb3eaf21717697c3c7df39b214b48ee3 (patch) | |
tree | 6ec56567a6f3355b1814ac18169d354239a729fc /src/quickshapes | |
parent | 8550dff55c62b4f2b588513014b5cad8fe2c5f5b (diff) |
Generate registrations for all imports
Now that we can generate all QML type information at build time, we
should also use it.
Move the types for QtTest into the testlib import plugin. They don't
need to be exported from QtQuickTest.
Trigger the resource initialization of the shapes library from the
plugin so that we retain a dependency and the linker doesn't optimize
the module initialization away.
Change-Id: Icc8cb338aa03ef1e3085e29356a5db7b73ba0a01
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/quickshapes')
-rw-r--r-- | src/quickshapes/qquickshape.cpp | 22 | ||||
-rw-r--r-- | src/quickshapes/qquickshape_p.h | 6 | ||||
-rw-r--r-- | src/quickshapes/quickshapes.pro | 6 |
3 files changed, 19 insertions, 15 deletions
diff --git a/src/quickshapes/qquickshape.cpp b/src/quickshapes/qquickshape.cpp index a7db65f16f..dcd331b388 100644 --- a/src/quickshapes/qquickshape.cpp +++ b/src/quickshapes/qquickshape.cpp @@ -49,12 +49,12 @@ #include <QLoggingCategory> #include <QtGui/private/qrhi_p.h> -#if defined(QT_STATIC) static void initResources() { +#if defined(QT_STATIC) Q_INIT_RESOURCE(qtquickshapes); -} #endif +} QT_BEGIN_NAMESPACE @@ -73,6 +73,11 @@ Q_LOGGING_CATEGORY(QQSHAPE_LOG_TIME_DIRTY_SYNC, "qt.shape.time.sync") \endqml */ +void QQuickShapesModule::defineModule() +{ + initResources(); +} + QQuickShapeStrokeFillParams::QQuickShapeStrokeFillParams() : strokeColor(Qt::white), strokeWidth(1), @@ -667,22 +672,9 @@ void QQuickShapePrivate::setStatus(QQuickShape::Status newStatus) } } -struct QQuickShapeResourceInitializer -{ - QQuickShapeResourceInitializer() - { -#if defined(QT_STATIC) - initResources(); -#endif - } -}; - -Q_GLOBAL_STATIC(QQuickShapeResourceInitializer, initQQuickShapeResources) - QQuickShape::QQuickShape(QQuickItem *parent) : QQuickItem(*(new QQuickShapePrivate), parent) { - initQQuickShapeResources(); setFlag(ItemHasContents); } diff --git a/src/quickshapes/qquickshape_p.h b/src/quickshapes/qquickshape_p.h index cadc65f7cd..f86f2b03d6 100644 --- a/src/quickshapes/qquickshape_p.h +++ b/src/quickshapes/qquickshape_p.h @@ -63,6 +63,12 @@ QT_BEGIN_NAMESPACE class QQuickShapePathPrivate; class QQuickShapePrivate; +class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapesModule +{ +public: + static void defineModule(); +}; + class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapeGradient : public QQuickGradient { Q_OBJECT diff --git a/src/quickshapes/quickshapes.pro b/src/quickshapes/quickshapes.pro index 5a59dec18e..4dbd3e5e46 100644 --- a/src/quickshapes/quickshapes.pro +++ b/src/quickshapes/quickshapes.pro @@ -31,3 +31,9 @@ qtConfig(opengl) { RESOURCES += qtquickshapes.qrc load(qt_module) + +QMLTYPES_FILENAME = plugins.qmltypes +QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/QtQuick/Shapes +QML_IMPORT_NAME = QtQuick.Shapes +IMPORT_VERSION = 1.$$QT_MINOR_VERSION +CONFIG += qmltypes install_qmltypes install_metatypes |