diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-03-10 15:09:37 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-03-12 15:03:03 +0100 |
commit | 26c5243491f495194f04b449128dae36118e28da (patch) | |
tree | 7fb14678a6fc9e44a10c9224d005e2cbdc6bcb63 /src/imports | |
parent | 1c7d264e3b2e9a2f0021786ea6967185f8282af0 (diff) | |
parent | c24c5baeda4101b0058689adf9200b77a722c3a2 (diff) |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Conflicts:
dependencies.yaml
src/qml/qml/qqmlengine.cpp
Change-Id: I6a73fd1064286f4a2232de85c2ce7f80452d4641
Diffstat (limited to 'src/imports')
69 files changed, 391 insertions, 132 deletions
diff --git a/src/imports/folderlistmodel/folderlistmodel.pro b/src/imports/folderlistmodel/folderlistmodel.pro index 8eaf9de6b9..c95a88430d 100644 --- a/src/imports/folderlistmodel/folderlistmodel.pro +++ b/src/imports/folderlistmodel/folderlistmodel.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = qmlfolderlistmodelplugin TARGETPATH = Qt/labs/folderlistmodel -IMPORT_VERSION = 2.15 +QML_IMPORT_VERSION = $$QT_VERSION QT = core-private qml-private diff --git a/src/imports/folderlistmodel/plugin.cpp b/src/imports/folderlistmodel/plugin.cpp index 28837655ef..7a38769b77 100644 --- a/src/imports/folderlistmodel/plugin.cpp +++ b/src/imports/folderlistmodel/plugin.cpp @@ -42,6 +42,8 @@ #include "qquickfolderlistmodel.h" +extern void qml_register_types_Qt_labs_folderlistmodel(); + QT_BEGIN_NAMESPACE //![class decl] @@ -51,7 +53,12 @@ class QmlFolderListModelPlugin : public QQmlExtensionPlugin Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QmlFolderListModelPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { } + QmlFolderListModelPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) + { + volatile auto registration = &qml_register_types_Qt_labs_folderlistmodel; + Q_UNUSED(registration); + } + void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.folderlistmodel")); diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.h b/src/imports/folderlistmodel/qquickfolderlistmodel.h index 5897bd2e0f..d7429efeda 100644 --- a/src/imports/folderlistmodel/qquickfolderlistmodel.h +++ b/src/imports/folderlistmodel/qquickfolderlistmodel.h @@ -67,19 +67,20 @@ class QQuickFolderListModel : public QAbstractListModel, public QQmlParserStatus Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters) Q_PROPERTY(SortField sortField READ sortField WRITE setSortField) Q_PROPERTY(bool sortReversed READ sortReversed WRITE setSortReversed) - Q_PROPERTY(bool showFiles READ showFiles WRITE setShowFiles REVISION 1) + Q_PROPERTY(bool showFiles READ showFiles WRITE setShowFiles REVISION(2, 1)) Q_PROPERTY(bool showDirs READ showDirs WRITE setShowDirs) Q_PROPERTY(bool showDirsFirst READ showDirsFirst WRITE setShowDirsFirst) Q_PROPERTY(bool showDotAndDotDot READ showDotAndDotDot WRITE setShowDotAndDotDot) - Q_PROPERTY(bool showHidden READ showHidden WRITE setShowHidden REVISION 1) + Q_PROPERTY(bool showHidden READ showHidden WRITE setShowHidden REVISION(2, 1)) Q_PROPERTY(bool showOnlyReadable READ showOnlyReadable WRITE setShowOnlyReadable) - Q_PROPERTY(bool caseSensitive READ caseSensitive WRITE setCaseSensitive REVISION 2) + Q_PROPERTY(bool caseSensitive READ caseSensitive WRITE setCaseSensitive REVISION(2, 2)) Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(Status status READ status NOTIFY statusChanged REVISION 11) - Q_PROPERTY(bool sortCaseSensitive READ sortCaseSensitive WRITE setSortCaseSensitive REVISION 12) + Q_PROPERTY(Status status READ status NOTIFY statusChanged REVISION(2, 11)) + Q_PROPERTY(bool sortCaseSensitive READ sortCaseSensitive WRITE setSortCaseSensitive REVISION(2, 12)) //![class props] QML_NAMED_ELEMENT(FolderListModel) + QML_ADDED_IN_VERSION(2, 0) //![abslistmodel] public: QQuickFolderListModel(QObject *parent = nullptr); @@ -163,8 +164,8 @@ public: Q_SIGNALS: void folderChanged(); void rowCountChanged() const; - Q_REVISION(1) void countChanged() const; - Q_REVISION(11) void statusChanged(); + Q_REVISION(2, 1) void countChanged() const; + Q_REVISION(2, 11) void statusChanged(); //![notifier] //![class end] diff --git a/src/imports/labsanimation/labsanimation.pro b/src/imports/labsanimation/labsanimation.pro index f64ae775c6..5fd8ff25a7 100644 --- a/src/imports/labsanimation/labsanimation.pro +++ b/src/imports/labsanimation/labsanimation.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = labsanimationplugin TARGETPATH = Qt/labs/animation -IMPORT_VERSION = 1.0 +QML_IMPORT_VERSION = $$QT_VERSION SOURCES += \ qquickboundaryrule.cpp \ diff --git a/src/imports/labsanimation/plugin.cpp b/src/imports/labsanimation/plugin.cpp index bd732a6aba..9c985f0dcf 100644 --- a/src/imports/labsanimation/plugin.cpp +++ b/src/imports/labsanimation/plugin.cpp @@ -42,6 +42,8 @@ #include "qquickboundaryrule_p.h" +extern void qml_register_types_Qt_labs_animation(); + QT_BEGIN_NAMESPACE /*! @@ -66,7 +68,11 @@ class QtLabsAnimationPlugin : public QQmlEngineExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) public: - QtLabsAnimationPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { } + QtLabsAnimationPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) + { + volatile auto registration = &qml_register_types_Qt_labs_animation; + Q_UNUSED(registration); + } }; //![class decl] diff --git a/src/imports/labsanimation/qquickboundaryrule_p.h b/src/imports/labsanimation/qquickboundaryrule_p.h index 1681558304..33cf0bb094 100644 --- a/src/imports/labsanimation/qquickboundaryrule_p.h +++ b/src/imports/labsanimation/qquickboundaryrule_p.h @@ -78,6 +78,7 @@ class QQuickBoundaryRule : public QObject, public QQmlPropertyValueInterceptor Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged) Q_PROPERTY(int returnDuration READ returnDuration WRITE setReturnDuration NOTIFY returnDurationChanged) QML_NAMED_ELEMENT(BoundaryRule) + QML_ADDED_IN_VERSION(1, 0) public: enum OvershootFilter { diff --git a/src/imports/labsmodels/labsmodels.pro b/src/imports/labsmodels/labsmodels.pro index 13468348cb..9fc52ce9cc 100644 --- a/src/imports/labsmodels/labsmodels.pro +++ b/src/imports/labsmodels/labsmodels.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = labsmodelsplugin TARGETPATH = Qt/labs/qmlmodels -IMPORT_VERSION = 1.0 +QML_IMPORT_VERSION = $$QT_VERSION QT = qml-private qmlmodels-private diff --git a/src/imports/labsmodels/plugin.cpp b/src/imports/labsmodels/plugin.cpp index feb4f3ba0a..ab5e0023a6 100644 --- a/src/imports/labsmodels/plugin.cpp +++ b/src/imports/labsmodels/plugin.cpp @@ -50,6 +50,8 @@ #include "qqmldelegatecomponent_p.h" #endif +extern void qml_register_types_Qt_labs_qmlmodels(); + QT_BEGIN_NAMESPACE /*! @@ -74,7 +76,11 @@ class QtQmlLabsModelsPlugin : public QQmlEngineExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) public: - QtQmlLabsModelsPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { } + QtQmlLabsModelsPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) + { + volatile auto registration = &qml_register_types_Qt_labs_qmlmodels; + Q_UNUSED(registration); + } }; //![class decl] diff --git a/src/imports/labsmodels/qqmldelegatecomponent.cpp b/src/imports/labsmodels/qqmldelegatecomponent.cpp index aaf3fea5da..b8eb8049b3 100644 --- a/src/imports/labsmodels/qqmldelegatecomponent.cpp +++ b/src/imports/labsmodels/qqmldelegatecomponent.cpp @@ -250,7 +250,9 @@ QQmlListProperty<QQmlDelegateChoice> QQmlDelegateChooser::choices() QQmlDelegateChooser::choices_append, QQmlDelegateChooser::choices_count, QQmlDelegateChooser::choices_at, - QQmlDelegateChooser::choices_clear); + QQmlDelegateChooser::choices_clear, + QQmlDelegateChooser::choices_replace, + QQmlDelegateChooser::choices_removeLast); } void QQmlDelegateChooser::choices_append(QQmlListProperty<QQmlDelegateChoice> *prop, QQmlDelegateChoice *choice) @@ -282,6 +284,26 @@ void QQmlDelegateChooser::choices_clear(QQmlListProperty<QQmlDelegateChoice> *pr q->delegateChanged(); } +void QQmlDelegateChooser::choices_replace(QQmlListProperty<QQmlDelegateChoice> *prop, int index, + QQmlDelegateChoice *choice) +{ + QQmlDelegateChooser *q = static_cast<QQmlDelegateChooser *>(prop->object); + disconnect(q->m_choices[index], &QQmlDelegateChoice::changed, + q, &QQmlAbstractDelegateComponent::delegateChanged); + q->m_choices[index] = choice; + connect(choice, &QQmlDelegateChoice::changed, q, + &QQmlAbstractDelegateComponent::delegateChanged); + q->delegateChanged(); +} + +void QQmlDelegateChooser::choices_removeLast(QQmlListProperty<QQmlDelegateChoice> *prop) +{ + QQmlDelegateChooser *q = static_cast<QQmlDelegateChooser *>(prop->object); + disconnect(q->m_choices.takeLast(), &QQmlDelegateChoice::changed, + q, &QQmlAbstractDelegateComponent::delegateChanged); + q->delegateChanged(); +} + QQmlComponent *QQmlDelegateChooser::delegate(QQmlAdaptorModel *adaptorModel, int row, int column) const { QVariant v; diff --git a/src/imports/labsmodels/qqmldelegatecomponent_p.h b/src/imports/labsmodels/qqmldelegatecomponent_p.h index 4c39dc0d0a..9655d1baf9 100644 --- a/src/imports/labsmodels/qqmldelegatecomponent_p.h +++ b/src/imports/labsmodels/qqmldelegatecomponent_p.h @@ -69,6 +69,8 @@ class QQmlDelegateChoice : public QObject Q_PROPERTY(QQmlComponent* delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) Q_CLASSINFO("DefaultProperty", "delegate") QML_NAMED_ELEMENT(DelegateChoice) + QML_ADDED_IN_VERSION(1, 0) + public: QVariant roleValue() const; void setRoleValue(const QVariant &roleValue); @@ -106,6 +108,7 @@ class QQmlDelegateChooser : public QQmlAbstractDelegateComponent Q_PROPERTY(QQmlListProperty<QQmlDelegateChoice> choices READ choices CONSTANT) Q_CLASSINFO("DefaultProperty", "choices") QML_NAMED_ELEMENT(DelegateChooser) + QML_ADDED_IN_VERSION(1, 0) public: QString role() const { return m_role; } @@ -116,6 +119,8 @@ public: static int choices_count(QQmlListProperty<QQmlDelegateChoice> *); static QQmlDelegateChoice *choices_at(QQmlListProperty<QQmlDelegateChoice> *, int); static void choices_clear(QQmlListProperty<QQmlDelegateChoice> *); + static void choices_replace(QQmlListProperty<QQmlDelegateChoice> *, int, QQmlDelegateChoice *); + static void choices_removeLast(QQmlListProperty<QQmlDelegateChoice> *); QQmlComponent *delegate(QQmlAdaptorModel *adaptorModel, int row, int column = -1) const override; diff --git a/src/imports/labsmodels/qqmltablemodel.cpp b/src/imports/labsmodels/qqmltablemodel.cpp index b6468d760f..6ba2cecf19 100644 --- a/src/imports/labsmodels/qqmltablemodel.cpp +++ b/src/imports/labsmodels/qqmltablemodel.cpp @@ -644,7 +644,9 @@ QQmlListProperty<QQmlTableModelColumn> QQmlTableModel::columns() &QQmlTableModel::columns_append, &QQmlTableModel::columns_count, &QQmlTableModel::columns_at, - &QQmlTableModel::columns_clear); + &QQmlTableModel::columns_clear, + &QQmlTableModel::columns_replace, + &QQmlTableModel::columns_removeLast); } void QQmlTableModel::columns_append(QQmlListProperty<QQmlTableModelColumn> *property, @@ -674,6 +676,19 @@ void QQmlTableModel::columns_clear(QQmlListProperty<QQmlTableModelColumn> *prope return model->mColumns.clear(); } +void QQmlTableModel::columns_replace(QQmlListProperty<QQmlTableModelColumn> *property, int index, QQmlTableModelColumn *value) +{ + QQmlTableModel *model = static_cast<QQmlTableModel*>(property->object); + if (QQmlTableModelColumn *column = qobject_cast<QQmlTableModelColumn*>(value)) + return model->mColumns.replace(index, column); +} + +void QQmlTableModel::columns_removeLast(QQmlListProperty<QQmlTableModelColumn> *property) +{ + QQmlTableModel *model = static_cast<QQmlTableModel*>(property->object); + model->mColumns.removeLast(); +} + /*! \qmlmethod QModelIndex TableModel::index(int row, int column) diff --git a/src/imports/labsmodels/qqmltablemodel_p.h b/src/imports/labsmodels/qqmltablemodel_p.h index d6e982d19a..ae46cbe35c 100644 --- a/src/imports/labsmodels/qqmltablemodel_p.h +++ b/src/imports/labsmodels/qqmltablemodel_p.h @@ -74,6 +74,7 @@ class QQmlTableModel : public QAbstractTableModel, public QQmlParserStatus Q_INTERFACES(QQmlParserStatus) Q_CLASSINFO("DefaultProperty", "columns") QML_NAMED_ELEMENT(TableModel) + QML_ADDED_IN_VERSION(1, 0) public: QQmlTableModel(QObject *parent = nullptr); @@ -96,6 +97,8 @@ public: static int columns_count(QQmlListProperty<QQmlTableModelColumn> *property); static QQmlTableModelColumn *columns_at(QQmlListProperty<QQmlTableModelColumn> *property, int index); static void columns_clear(QQmlListProperty<QQmlTableModelColumn> *property); + static void columns_replace(QQmlListProperty<QQmlTableModelColumn> *property, int index, QQmlTableModelColumn *value); + static void columns_removeLast(QQmlListProperty<QQmlTableModelColumn> *property); QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override; diff --git a/src/imports/labsmodels/qqmltablemodelcolumn_p.h b/src/imports/labsmodels/qqmltablemodelcolumn_p.h index a18f21ab4f..2860a915cc 100644 --- a/src/imports/labsmodels/qqmltablemodelcolumn_p.h +++ b/src/imports/labsmodels/qqmltablemodelcolumn_p.h @@ -97,6 +97,7 @@ class QQmlTableModelColumn : public QObject Q_PROPERTY(QJSValue sizeHint READ sizeHint WRITE setSizeHint NOTIFY sizeHintChanged FINAL) Q_PROPERTY(QJSValue setSizeHint READ getSetSizeHint WRITE setSetSizeHint NOTIFY setSizeHintChanged FINAL) QML_NAMED_ELEMENT(TableModelColumn) + QML_ADDED_IN_VERSION(1, 0) public: QQmlTableModelColumn(QObject *parent = nullptr); diff --git a/src/imports/layouts/layouts.pro b/src/imports/layouts/layouts.pro index c52046094e..1ae269da32 100644 --- a/src/imports/layouts/layouts.pro +++ b/src/imports/layouts/layouts.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = qquicklayoutsplugin TARGETPATH = QtQuick/Layouts -IMPORT_VERSION = 1.15 +QML_IMPORT_VERSION = $$QT_VERSION QT *= qml-private quick-private gui-private core-private diff --git a/src/imports/layouts/plugin.cpp b/src/imports/layouts/plugin.cpp index c302b79164..af270c1732 100644 --- a/src/imports/layouts/plugin.cpp +++ b/src/imports/layouts/plugin.cpp @@ -42,6 +42,8 @@ #include "qquicklinearlayout_p.h" #include "qquickstacklayout_p.h" +extern void qml_register_types_QtQuick_Layouts(); + QT_BEGIN_NAMESPACE //![class decl] @@ -52,6 +54,8 @@ class QtQuickLayoutsPlugin : public QQmlEngineExtensionPlugin public: QtQuickLayoutsPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { + volatile auto registration = &qml_register_types_QtQuick_Layouts; + Q_UNUSED(registration); } }; //![class decl] diff --git a/src/imports/layouts/qquicklayout.cpp b/src/imports/layouts/qquicklayout.cpp index 1ca4056ba9..33c27bd928 100644 --- a/src/imports/layouts/qquicklayout.cpp +++ b/src/imports/layouts/qquicklayout.cpp @@ -700,8 +700,10 @@ QQuickItem *QQuickLayoutAttached::item() const QQuickLayout::QQuickLayout(QQuickLayoutPrivate &dd, QQuickItem *parent) - : QQuickItem(dd, parent), - m_dirty(false) + : QQuickItem(dd, parent) + , m_dirty(false) + , m_inUpdatePolish(false) + , m_polishInsideUpdatePolish(0) { } @@ -728,7 +730,9 @@ QQuickLayoutAttached *QQuickLayout::qmlAttachedProperties(QObject *object) void QQuickLayout::updatePolish() { + m_inUpdatePolish = true; rearrange(QSizeF(width(), height())); + m_inUpdatePolish = false; } void QQuickLayout::componentComplete() @@ -749,7 +753,18 @@ void QQuickLayout::invalidate(QQuickItem * /*childItem*/) if (!qobject_cast<QQuickLayout *>(parentItem())) { quickLayoutDebug() << "QQuickLayout::invalidate(), polish()"; - polish(); + + if (m_inUpdatePolish) + ++m_polishInsideUpdatePolish; + else + m_polishInsideUpdatePolish = 0; + + if (m_polishInsideUpdatePolish <= 2) + // allow at most two consecutive loops in order to respond to height-for-width + // (e.g QQuickText changes implicitHeight when its width gets changed) + polish(); + else + qWarning() << "Qt Quick Layouts: Polish loop detected. Aborting after two iterations."; } } diff --git a/src/imports/layouts/qquicklayout_p.h b/src/imports/layouts/qquicklayout_p.h index cb46c41e6c..a2594f4274 100644 --- a/src/imports/layouts/qquicklayout_p.h +++ b/src/imports/layouts/qquicklayout_p.h @@ -62,6 +62,7 @@ class QQuickLayout : public QQuickItem, public QQuickItemChangeListener { Q_OBJECT QML_NAMED_ELEMENT(Layout) + QML_ADDED_IN_VERSION(1, 0) QML_UNCREATABLE("Do not create objects of type Layout.") QML_ATTACHED(QQuickLayoutAttached) @@ -123,7 +124,9 @@ protected slots: void invalidateSenderItem(); private: - bool m_dirty; + unsigned m_dirty : 1; + unsigned m_inUpdatePolish : 1; + unsigned m_polishInsideUpdatePolish : 2; Q_DECLARE_PRIVATE(QQuickLayout) diff --git a/src/imports/layouts/qquicklinearlayout.cpp b/src/imports/layouts/qquicklinearlayout.cpp index 344ea7237c..e47eba4164 100644 --- a/src/imports/layouts/qquicklinearlayout.cpp +++ b/src/imports/layouts/qquicklinearlayout.cpp @@ -469,6 +469,16 @@ void QQuickGridLayoutBase::rearrange(const QSizeF &size) if (!isReady()) return; + const auto refCounter = qScopeGuard([&d] { + --(d->m_recurRearrangeCounter); + }); + if (d->m_recurRearrangeCounter++ == 2) { + // allow a recursive depth of two in order to respond to height-for-width + // (e.g QQuickText changes implicitHeight when its width gets changed) + qWarning() << "Qt Quick Layouts: Detected recursive rearrange. Aborting after two iterations."; + return; + } + d->m_rearranging = true; quickLayoutDebug() << objectName() << "QQuickGridLayoutBase::rearrange()" << size; Qt::LayoutDirection visualDir = effectiveLayoutDirection(); diff --git a/src/imports/layouts/qquicklinearlayout_p.h b/src/imports/layouts/qquicklinearlayout_p.h index 634e51a048..1780ba8807 100644 --- a/src/imports/layouts/qquicklinearlayout_p.h +++ b/src/imports/layouts/qquicklinearlayout_p.h @@ -56,9 +56,10 @@ class QQuickGridLayoutBase : public QQuickLayout { Q_OBJECT - Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection + NOTIFY layoutDirectionChanged REVISION(1, 1)) QML_ANONYMOUS - QML_ADDED_IN_MINOR_VERSION(1) + QML_ADDED_IN_VERSION(1, 1) public: @@ -92,7 +93,7 @@ protected: virtual void insertLayoutItems() {} signals: - Q_REVISION(1) void layoutDirectionChanged(); + Q_REVISION(1, 1) void layoutDirectionChanged(); private: void removeGridItem(QGridLayoutItem *gridItem); @@ -106,7 +107,8 @@ class QQuickGridLayoutBasePrivate : public QQuickLayoutPrivate Q_DECLARE_PUBLIC(QQuickGridLayoutBase) public: - QQuickGridLayoutBasePrivate() : m_rearranging(false) + QQuickGridLayoutBasePrivate() : m_recurRearrangeCounter(0) + , m_rearranging(false) , m_updateAfterRearrange(false) , m_layoutDirection(Qt::LeftToRight) {} @@ -119,6 +121,7 @@ public: QQuickGridLayoutEngine engine; Qt::Orientation orientation; + unsigned m_recurRearrangeCounter : 2; unsigned m_rearranging : 1; unsigned m_updateAfterRearrange : 1; QVector<QQuickItem *> m_invalidateAfterRearrange; @@ -143,6 +146,7 @@ class QQuickGridLayout : public QQuickGridLayoutBase Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowsChanged) Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) QML_NAMED_ELEMENT(GridLayout) + QML_ADDED_IN_VERSION(1, 0) public: explicit QQuickGridLayout(QQuickItem *parent = 0); qreal columnSpacing() const; @@ -227,6 +231,7 @@ class QQuickRowLayout : public QQuickLinearLayout { Q_OBJECT QML_NAMED_ELEMENT(RowLayout) + QML_ADDED_IN_VERSION(1, 0) public: explicit QQuickRowLayout(QQuickItem *parent = 0) @@ -243,6 +248,7 @@ class QQuickColumnLayout : public QQuickLinearLayout { Q_OBJECT QML_NAMED_ELEMENT(ColumnLayout) + QML_ADDED_IN_VERSION(1, 0) public: explicit QQuickColumnLayout(QQuickItem *parent = 0) diff --git a/src/imports/layouts/qquickstacklayout_p.h b/src/imports/layouts/qquickstacklayout_p.h index 537d54900f..07f9e48178 100644 --- a/src/imports/layouts/qquickstacklayout_p.h +++ b/src/imports/layouts/qquickstacklayout_p.h @@ -52,7 +52,7 @@ class QQuickStackLayout : public QQuickLayout Q_PROPERTY(int count READ count NOTIFY countChanged) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) QML_NAMED_ELEMENT(StackLayout) - QML_ADDED_IN_MINOR_VERSION(3) + QML_ADDED_IN_VERSION(1, 3) public: explicit QQuickStackLayout(QQuickItem *parent = 0); diff --git a/src/imports/localstorage/localstorage.pro b/src/imports/localstorage/localstorage.pro index d189808f49..6dff4862c7 100644 --- a/src/imports/localstorage/localstorage.pro +++ b/src/imports/localstorage/localstorage.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = qmllocalstorageplugin TARGETPATH = QtQuick/LocalStorage -IMPORT_VERSION = 2.15 +QML_IMPORT_VERSION = $$QT_VERSION QT = sql qml-private core-private diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index ae9f37784d..e488b3d43c 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -42,6 +42,8 @@ #include <QtQml/qqmlextensionplugin.h> #include <QtQml/qqml.h> +extern void qml_register_types_QtQuick_LocalStorage(); + QT_BEGIN_NAMESPACE class QQmlLocalStoragePlugin : public QQmlEngineExtensionPlugin @@ -52,6 +54,8 @@ class QQmlLocalStoragePlugin : public QQmlEngineExtensionPlugin public: QQmlLocalStoragePlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { + volatile auto registration = &qml_register_types_QtQuick_LocalStorage; + Q_UNUSED(registration); } }; diff --git a/src/imports/localstorage/qquicklocalstorage_p.h b/src/imports/localstorage/qquicklocalstorage_p.h index d2ebc85ce9..f90d6bad28 100644 --- a/src/imports/localstorage/qquicklocalstorage_p.h +++ b/src/imports/localstorage/qquicklocalstorage_p.h @@ -61,6 +61,7 @@ class QQuickLocalStorage : public QObject { Q_OBJECT QML_NAMED_ELEMENT(LocalStorage) + QML_ADDED_IN_VERSION(2, 0) QML_SINGLETON public: diff --git a/src/imports/models/dependencies.json b/src/imports/models/dependencies.json deleted file mode 100644 index 0d4f101c7a..0000000000 --- a/src/imports/models/dependencies.json +++ /dev/null @@ -1,2 +0,0 @@ -[ -] diff --git a/src/imports/models/models.pro b/src/imports/models/models.pro index ab3f4e3e15..9a22049068 100644 --- a/src/imports/models/models.pro +++ b/src/imports/models/models.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = modelsplugin TARGETPATH = QtQml/Models -IMPORT_VERSION = 2.15 +QML_IMPORT_VERSION = $$QT_VERSION SOURCES += \ plugin.cpp diff --git a/src/imports/models/plugin.cpp b/src/imports/models/plugin.cpp index 4aa9f27766..c15866cf05 100644 --- a/src/imports/models/plugin.cpp +++ b/src/imports/models/plugin.cpp @@ -37,17 +37,11 @@ ** ****************************************************************************/ -#include <QtQmlModels/private/qqmlobjectmodel_p.h> - +#include <QtQmlModels/private/qtqmlmodelsglobal_p.h> #include <QtQml/qqmlextensionplugin.h> -#include <QtQml/qqml.h> - -#include <QtCore/qloggingcategory.h> QT_BEGIN_NAMESPACE -Q_LOGGING_CATEGORY(qmlModelsPlugin, "qt.qmlModelsPlugin") - /*! \qmlmodule QtQml.Models 2.\QtMinorVersion \title Qt QML Models QML Types @@ -92,13 +86,8 @@ class QtQmlModelsPlugin : public QQmlEngineExtensionPlugin public: QtQmlModelsPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { - if (qmlModelsPlugin().isDebugEnabled()) { - // Superficial debug message that causes the dependency between QtQmlWorkerScript - // and the workerscript plugin to be retained. - // As qCDebug() can be a noop, retrieve the className in a separate step. - const QString className = QQmlObjectModel::staticMetaObject.className(); - qCDebug(qmlModelsPlugin) << "Loading QmlModels plugin:" << className; - } + volatile auto registration = &qml_register_types_QtQml_Models; + Q_UNUSED(registration); } }; //![class decl] diff --git a/src/imports/particles/particles.pro b/src/imports/particles/particles.pro index 50e1837544..c0f2f990b5 100644 --- a/src/imports/particles/particles.pro +++ b/src/imports/particles/particles.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = particlesplugin TARGETPATH = QtQuick/Particles -IMPORT_VERSION = 2.15 +QML_IMPORT_VERSION = $$QT_VERSION SOURCES += \ plugin.cpp diff --git a/src/imports/particles/plugin.cpp b/src/imports/particles/plugin.cpp index 4f319db9f1..6629a660af 100644 --- a/src/imports/particles/plugin.cpp +++ b/src/imports/particles/plugin.cpp @@ -50,7 +50,12 @@ class QtQuick2ParticlesPlugin : public QQmlExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QtQuick2ParticlesPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { } + QtQuick2ParticlesPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) + { + volatile auto registration = &qml_register_types_QtQuick_Particles; + Q_UNUSED(registration); + } + void registerTypes(const char *uri) override { Q_UNUSED(uri); diff --git a/src/imports/qtqml/plugin.cpp b/src/imports/qtqml/plugin.cpp index ec08992355..a32d86eeb1 100644 --- a/src/imports/qtqml/plugin.cpp +++ b/src/imports/qtqml/plugin.cpp @@ -37,10 +37,8 @@ ** ****************************************************************************/ +#include <QtQml/private/qtqmlglobal_p.h> #include <QtQml/qqmlextensionplugin.h> -#include <QtQml/private/qqmlengine_p.h> -#include <QtQml/private/qqmlcomponentattached_p.h> -#include <QtQml/private/qqmlbind_p.h> QT_BEGIN_NAMESPACE @@ -66,7 +64,11 @@ class QtQmlPlugin : public QQmlEngineExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) public: - QtQmlPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) {} + QtQmlPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) + { + volatile auto registration = &qml_register_types_QtQml; + Q_UNUSED(registration); + } }; //![class decl] diff --git a/src/imports/qtqml/qtqml.pro b/src/imports/qtqml/qtqml.pro index 0211844b14..eac19954b6 100644 --- a/src/imports/qtqml/qtqml.pro +++ b/src/imports/qtqml/qtqml.pro @@ -1,7 +1,7 @@ TARGETPATH = QtQml CXX_MODULE = qml TARGET = qmlplugin -IMPORT_VERSION = 2.15 +QML_IMPORT_VERSION = $$QT_VERSION SOURCES += \ plugin.cpp diff --git a/src/imports/qtquick2/plugin.cpp b/src/imports/qtquick2/plugin.cpp index 98056aa551..dde0b7207a 100644 --- a/src/imports/qtquick2/plugin.cpp +++ b/src/imports/qtquick2/plugin.cpp @@ -50,7 +50,12 @@ class QtQuick2Plugin : public QQmlExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QtQuick2Plugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { } + QtQuick2Plugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) + { + volatile auto registration = &qml_register_types_QtQuick; + Q_UNUSED(registration); + } + void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick")); @@ -59,10 +64,11 @@ public: QQmlQtQuick2Module::defineModule(); } - ~QtQuick2Plugin() override + void unregisterTypes() override { if (moduleDefined) QQmlQtQuick2Module::undefineModule(); + moduleDefined = false; } bool moduleDefined = false; diff --git a/src/imports/qtquick2/qtquick2.pro b/src/imports/qtquick2/qtquick2.pro index f89518c054..35430d0638 100644 --- a/src/imports/qtquick2/qtquick2.pro +++ b/src/imports/qtquick2/qtquick2.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = qtquick2plugin TARGETPATH = QtQuick -IMPORT_VERSION = 2.15 +QML_IMPORT_VERSION = $$QT_VERSION SOURCES += \ plugin.cpp diff --git a/src/imports/settings/plugin.cpp b/src/imports/settings/plugin.cpp index 24ff43ea6f..e8e640412b 100644 --- a/src/imports/settings/plugin.cpp +++ b/src/imports/settings/plugin.cpp @@ -42,6 +42,8 @@ #include "qqmlsettings_p.h" +extern void qml_register_types_Qt_labs_settings(); + QT_BEGIN_NAMESPACE class QmlSettingsPlugin : public QQmlEngineExtensionPlugin @@ -50,7 +52,11 @@ class QmlSettingsPlugin : public QQmlEngineExtensionPlugin Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) public: - QmlSettingsPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) {} + QmlSettingsPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) + { + volatile auto registration = &qml_register_types_Qt_labs_settings; + Q_UNUSED(registration); + } }; QT_END_NAMESPACE diff --git a/src/imports/settings/qqmlsettings_p.h b/src/imports/settings/qqmlsettings_p.h index 3f1b83f541..100d0136ff 100644 --- a/src/imports/settings/qqmlsettings_p.h +++ b/src/imports/settings/qqmlsettings_p.h @@ -67,6 +67,7 @@ class QQmlSettings : public QObject, public QQmlParserStatus Q_PROPERTY(QString category READ category WRITE setCategory FINAL) Q_PROPERTY(QString fileName READ fileName WRITE setFileName FINAL) QML_NAMED_ELEMENT(Settings) + QML_ADDED_IN_VERSION(1, 0) public: explicit QQmlSettings(QObject *parent = 0); diff --git a/src/imports/settings/settings.pro b/src/imports/settings/settings.pro index d8062a2e55..6fd8b8cddd 100644 --- a/src/imports/settings/settings.pro +++ b/src/imports/settings/settings.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = qmlsettingsplugin TARGETPATH = Qt/labs/settings -IMPORT_VERSION = 1.1 +QML_IMPORT_VERSION = $$QT_VERSION QT = core qml diff --git a/src/imports/shapes/plugin.cpp b/src/imports/shapes/plugin.cpp index 3855a93fc7..48eecbd8f1 100644 --- a/src/imports/shapes/plugin.cpp +++ b/src/imports/shapes/plugin.cpp @@ -52,6 +52,8 @@ public: QmlShapesPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { + volatile auto registration = &qml_register_types_QtQuick_Shapes; + Q_UNUSED(registration); } void registerTypes(const char *uri) override diff --git a/src/imports/shapes/shapes.pro b/src/imports/shapes/shapes.pro index bb02dbf08f..b5f75343d7 100644 --- a/src/imports/shapes/shapes.pro +++ b/src/imports/shapes/shapes.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = qmlshapesplugin TARGETPATH = QtQuick/Shapes -IMPORT_VERSION = 1.15 +QML_IMPORT_VERSION = $$QT_VERSION QT = core gui-private qml quick-private quickshapes-private diff --git a/src/imports/sharedimage/plugin.cpp b/src/imports/sharedimage/plugin.cpp index 237fa64c61..d7c2ef8d17 100644 --- a/src/imports/sharedimage/plugin.cpp +++ b/src/imports/sharedimage/plugin.cpp @@ -99,6 +99,8 @@ The shared image module does not provide any directly usable QML types. */ +extern void qml_register_types_Qt_labs_sharedimage(); + QT_BEGIN_NAMESPACE class QtQuickSharedImagePlugin : public QQmlEngineExtensionPlugin @@ -106,7 +108,11 @@ class QtQuickSharedImagePlugin : public QQmlEngineExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) public: - QtQuickSharedImagePlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) {} + QtQuickSharedImagePlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) + { + volatile auto registration = &qml_register_types_Qt_labs_sharedimage; + Q_UNUSED(registration); + } void initializeEngine(QQmlEngine *engine, const char *uri) override { diff --git a/src/imports/sharedimage/qsharedimageloader_p.h b/src/imports/sharedimage/qsharedimageloader_p.h index 4b0e989c29..ce10d0d72c 100644 --- a/src/imports/sharedimage/qsharedimageloader_p.h +++ b/src/imports/sharedimage/qsharedimageloader_p.h @@ -43,6 +43,7 @@ #include <QImage> #include <QVariant> #include <QLoggingCategory> +#include <qqml.h> QT_BEGIN_NAMESPACE @@ -55,6 +56,10 @@ class QSharedImageLoader : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QSharedImageLoader) + // We need to provide some type, in order to mention the 1.0 version. + QML_ANONYMOUS + QML_ADDED_IN_VERSION(1, 0) + public: typedef QVector<QVariant> ImageParameters; diff --git a/src/imports/sharedimage/sharedimage.pro b/src/imports/sharedimage/sharedimage.pro index 8ab4f10405..cee4c3465e 100644 --- a/src/imports/sharedimage/sharedimage.pro +++ b/src/imports/sharedimage/sharedimage.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = sharedimageplugin TARGETPATH = Qt/labs/sharedimage -IMPORT_VERSION = 1.0 +QML_IMPORT_VERSION = $$QT_VERSION QT *= quick-private qml gui-private core-private diff --git a/src/imports/statemachine/childrenprivate.h b/src/imports/statemachine/childrenprivate.h index 57cda1c796..2dcecd6531 100644 --- a/src/imports/statemachine/childrenprivate.h +++ b/src/imports/statemachine/childrenprivate.h @@ -46,54 +46,142 @@ #include <QQmlInfo> #include <QQmlListProperty> -template <class T> -class ChildrenPrivate +enum class ChildrenMode { + None = 0x0, + State = 0x1, + Transition = 0x2, + StateOrTransition = State | Transition +}; + +template<typename T> +static T *parentObject(QQmlListProperty<QObject> *prop) { return static_cast<T *>(prop->object); } + +template<class T, ChildrenMode Mode> +struct ParentHandler { -public: - ChildrenPrivate() - {} + static bool unparentItem(QQmlListProperty<QObject> *prop, QObject *oldItem); + static bool parentItem(QQmlListProperty<QObject> *prop, QObject *item); +}; - static void append(QQmlListProperty<QObject> *prop, QObject *item) +template<class T> +struct ParentHandler<T, ChildrenMode::None> +{ + static bool unparentItem(QQmlListProperty<QObject> *, QObject *) { return true; } + static bool parentItem(QQmlListProperty<QObject> *, QObject *) { return true; } +}; + +template<class T> +struct ParentHandler<T, ChildrenMode::State> +{ + static bool parentItem(QQmlListProperty<QObject> *prop, QObject *item) + { + if (QAbstractState *state = qobject_cast<QAbstractState *>(item)) { + state->setParent(parentObject<T>(prop)); + return true; + } + return false; + } + + static bool unparentItem(QQmlListProperty<QObject> *, QObject *oldItem) + { + if (QAbstractState *state = qobject_cast<QAbstractState *>(oldItem)) { + state->setParent(nullptr); + return true; + } + return false; + } +}; + +template<class T> +struct ParentHandler<T, ChildrenMode::Transition> +{ + static bool parentItem(QQmlListProperty<QObject> *prop, QObject *item) { - QAbstractState *state = qobject_cast<QAbstractState*>(item); - if (state) { - item->setParent(prop->object); - } else { - QAbstractTransition *trans = qobject_cast<QAbstractTransition*>(item); - if (trans) - static_cast<T *>(prop->object)->addTransition(trans); + if (QAbstractTransition *trans = qobject_cast<QAbstractTransition *>(item)) { + parentObject<T>(prop)->addTransition(trans); + return true; } - static_cast<ChildrenPrivate<T>*>(prop->data)->children.append(item); - emit static_cast<T *>(prop->object)->childrenChanged(); + return false; } - static void appendNoTransition(QQmlListProperty<QObject> *prop, QObject *item) + static bool unparentItem(QQmlListProperty<QObject> *prop, QObject *oldItem) { - QAbstractState *state = qobject_cast<QAbstractState*>(item); - if (state) { - item->setParent(prop->object); + if (QAbstractTransition *trans = qobject_cast<QAbstractTransition *>(oldItem)) { + parentObject<T>(prop)->removeTransition(trans); + return true; } - static_cast<ChildrenPrivate<T>*>(prop->data)->children.append(item); - emit static_cast<T *>(prop->object)->childrenChanged(); + return false; + } +}; + +template<class T> +struct ParentHandler<T, ChildrenMode::StateOrTransition> +{ + static bool parentItem(QQmlListProperty<QObject> *prop, QObject *oldItem) + { + return ParentHandler<T, ChildrenMode::State>::parentItem(prop, oldItem) + || ParentHandler<T, ChildrenMode::Transition>::parentItem(prop, oldItem); + } + + static bool unparentItem(QQmlListProperty<QObject> *prop, QObject *oldItem) + { + return ParentHandler<T, ChildrenMode::State>::unparentItem(prop, oldItem) + || ParentHandler<T, ChildrenMode::Transition>::unparentItem(prop, oldItem); + } +}; + +template <class T, ChildrenMode Mode> +class ChildrenPrivate +{ +public: + static void append(QQmlListProperty<QObject> *prop, QObject *item) + { + Handler::parentItem(prop, item); + static_cast<Self *>(prop->data)->children.append(item); + emit parentObject<T>(prop)->childrenChanged(); } static int count(QQmlListProperty<QObject> *prop) { - return static_cast<ChildrenPrivate<T>*>(prop->data)->children.count(); + return static_cast<Self *>(prop->data)->children.count(); } static QObject *at(QQmlListProperty<QObject> *prop, int index) { - return static_cast<ChildrenPrivate<T>*>(prop->data)->children.at(index); + return static_cast<Self *>(prop->data)->children.at(index); } static void clear(QQmlListProperty<QObject> *prop) { - static_cast<ChildrenPrivate<T>*>(prop->data)->children.clear(); - emit static_cast<T *>(prop->object)->childrenChanged(); + auto &children = static_cast<Self *>(prop->data)->children; + for (QObject *oldItem : qAsConst(children)) + Handler::unparentItem(prop, oldItem); + + children.clear(); + emit parentObject<T>(prop)->childrenChanged(); + } + + static void replace(QQmlListProperty<QObject> *prop, int index, QObject *item) + { + auto &children = static_cast<Self *>(prop->data)->children; + + Handler::unparentItem(prop, children.at(index)); + Handler::parentItem(prop, item); + + children.replace(index, item); + emit parentObject<T>(prop)->childrenChanged(); + } + + static void removeLast(QQmlListProperty<QObject> *prop) + { + Handler::unparentItem(prop, static_cast<Self *>(prop->data)->children.takeLast()); + emit parentObject<T>(prop)->childrenChanged(); } private: + using Self = ChildrenPrivate<T, Mode>; + using Handler = ParentHandler<T, Mode>; + QList<QObject *> children; }; diff --git a/src/imports/statemachine/finalstate.cpp b/src/imports/statemachine/finalstate.cpp index 54dcc82bae..4d4c6b2cc7 100644 --- a/src/imports/statemachine/finalstate.cpp +++ b/src/imports/statemachine/finalstate.cpp @@ -50,7 +50,9 @@ FinalState::FinalState(QState *parent) QQmlListProperty<QObject> FinalState::children() { - return QQmlListProperty<QObject>(this, &m_children, m_children.appendNoTransition, m_children.count, m_children.at, m_children.clear); + return QQmlListProperty<QObject>(this, &m_children, + m_children.append, m_children.count, m_children.at, + m_children.clear, m_children.replace, m_children.removeLast); } /*! diff --git a/src/imports/statemachine/finalstate.h b/src/imports/statemachine/finalstate.h index 9cdbb51584..fef0e9c092 100644 --- a/src/imports/statemachine/finalstate.h +++ b/src/imports/statemachine/finalstate.h @@ -56,6 +56,7 @@ class FinalState : public QFinalState Q_PROPERTY(QQmlListProperty<QObject> children READ children NOTIFY childrenChanged) Q_CLASSINFO("DefaultProperty", "children") QML_ELEMENT + QML_ADDED_IN_VERSION(1, 0) public: explicit FinalState(QState *parent = 0); @@ -66,7 +67,7 @@ Q_SIGNALS: void childrenChanged(); private: - ChildrenPrivate<FinalState> m_children; + ChildrenPrivate<FinalState, ChildrenMode::State> m_children; }; QT_END_NAMESPACE diff --git a/src/imports/statemachine/plugin.cpp b/src/imports/statemachine/plugin.cpp index 4c991994f3..c370504029 100644 --- a/src/imports/statemachine/plugin.cpp +++ b/src/imports/statemachine/plugin.cpp @@ -48,6 +48,8 @@ #include <QQmlExtensionPlugin> #include <qqml.h> +extern void qml_register_types_QtQml_StateMachine(); + QT_BEGIN_NAMESPACE class QtQmlStateMachinePlugin : public QQmlEngineExtensionPlugin @@ -56,7 +58,11 @@ class QtQmlStateMachinePlugin : public QQmlEngineExtensionPlugin Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) public: - QtQmlStateMachinePlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { } + QtQmlStateMachinePlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) + { + volatile auto registration = &qml_register_types_QtQml_StateMachine; + Q_UNUSED(registration); + } }; QT_END_NAMESPACE diff --git a/src/imports/statemachine/signaltransition.h b/src/imports/statemachine/signaltransition.h index 748e230b3e..4d73368eb0 100644 --- a/src/imports/statemachine/signaltransition.h +++ b/src/imports/statemachine/signaltransition.h @@ -58,6 +58,7 @@ class SignalTransition : public QSignalTransition, public QQmlParserStatus Q_PROPERTY(QJSValue signal READ signal WRITE setSignal NOTIFY qmlSignalChanged) Q_PROPERTY(QQmlScriptString guard READ guard WRITE setGuard NOTIFY guardChanged) QML_ELEMENT + QML_ADDED_IN_VERSION(1, 0) public: explicit SignalTransition(QState *parent = nullptr); diff --git a/src/imports/statemachine/state.cpp b/src/imports/statemachine/state.cpp index af76087256..10530c2985 100644 --- a/src/imports/statemachine/state.cpp +++ b/src/imports/statemachine/state.cpp @@ -61,7 +61,9 @@ void State::componentComplete() QQmlListProperty<QObject> State::children() { - return QQmlListProperty<QObject>(this, &m_children, m_children.append, m_children.count, m_children.at, m_children.clear); + return QQmlListProperty<QObject>(this, &m_children, + m_children.append, m_children.count, m_children.at, + m_children.clear, m_children.replace, m_children.removeLast); } /*! diff --git a/src/imports/statemachine/state.h b/src/imports/statemachine/state.h index 4b17ea0e5f..8cb454f3cf 100644 --- a/src/imports/statemachine/state.h +++ b/src/imports/statemachine/state.h @@ -56,6 +56,7 @@ class State : public QState, public QQmlParserStatus Q_PROPERTY(QQmlListProperty<QObject> children READ children NOTIFY childrenChanged) Q_CLASSINFO("DefaultProperty", "children") QML_ELEMENT + QML_ADDED_IN_VERSION(1, 0) public: explicit State(QState *parent = 0); @@ -69,7 +70,7 @@ Q_SIGNALS: void childrenChanged(); private: - ChildrenPrivate<State> m_children; + ChildrenPrivate<State, ChildrenMode::StateOrTransition> m_children; }; QT_END_NAMESPACE diff --git a/src/imports/statemachine/statemachine.cpp b/src/imports/statemachine/statemachine.cpp index a983644018..bdad2e6bde 100644 --- a/src/imports/statemachine/statemachine.cpp +++ b/src/imports/statemachine/statemachine.cpp @@ -90,7 +90,9 @@ void StateMachine::componentComplete() QQmlListProperty<QObject> StateMachine::children() { - return QQmlListProperty<QObject>(this, &m_children, m_children.append, m_children.count, m_children.at, m_children.clear); + return QQmlListProperty<QObject>(this, &m_children, + m_children.append, m_children.count, m_children.at, + m_children.clear, m_children.replace, m_children.removeLast); } /*! diff --git a/src/imports/statemachine/statemachine.h b/src/imports/statemachine/statemachine.h index 04894477b3..85ac4cf26b 100644 --- a/src/imports/statemachine/statemachine.h +++ b/src/imports/statemachine/statemachine.h @@ -60,6 +60,7 @@ class StateMachine : public QStateMachine, public QQmlParserStatus Q_CLASSINFO("DefaultProperty", "children") QML_ELEMENT + QML_ADDED_IN_VERSION(1, 0) public: explicit StateMachine(QObject *parent = 0); @@ -82,7 +83,7 @@ Q_SIGNALS: void qmlRunningChanged(); private: - ChildrenPrivate<StateMachine> m_children; + ChildrenPrivate<StateMachine, ChildrenMode::StateOrTransition> m_children; bool m_completed; bool m_running; }; diff --git a/src/imports/statemachine/statemachine.pro b/src/imports/statemachine/statemachine.pro index b17ec6140d..cff81c2416 100644 --- a/src/imports/statemachine/statemachine.pro +++ b/src/imports/statemachine/statemachine.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = qtqmlstatemachine TARGETPATH = QtQml/StateMachine -IMPORT_VERSION = 1.15 +QML_IMPORT_VERSION = $$QT_VERSION QT = core-private qml-private diff --git a/src/imports/statemachine/statemachineforeign.h b/src/imports/statemachine/statemachineforeign.h index 363c9d0e31..7543d55fdf 100644 --- a/src/imports/statemachine/statemachineforeign.h +++ b/src/imports/statemachine/statemachineforeign.h @@ -51,6 +51,7 @@ struct QHistoryStateForeign Q_GADGET QML_FOREIGN(QHistoryState) QML_NAMED_ELEMENT(HistoryState) + QML_ADDED_IN_VERSION(1, 0) }; struct QStateForeign @@ -58,6 +59,7 @@ struct QStateForeign Q_GADGET QML_FOREIGN(QState) QML_NAMED_ELEMENT(QState) + QML_ADDED_IN_VERSION(1, 0) QML_UNCREATABLE("Don't use this, use State instead.") }; @@ -66,6 +68,7 @@ struct QAbstractStateForeign Q_GADGET QML_FOREIGN(QAbstractState) QML_NAMED_ELEMENT(QAbstractState) + QML_ADDED_IN_VERSION(1, 0) QML_UNCREATABLE("Don't use this, use State instead.") }; @@ -74,6 +77,7 @@ struct QSignalTransitionForeign Q_GADGET QML_FOREIGN(QSignalTransition) QML_NAMED_ELEMENT(QSignalTransition) + QML_ADDED_IN_VERSION(1, 0) QML_UNCREATABLE("Don't use this, use SignalTransition instead.") }; diff --git a/src/imports/statemachine/timeouttransition.h b/src/imports/statemachine/timeouttransition.h index cc3a22e0e5..3d056b5e41 100644 --- a/src/imports/statemachine/timeouttransition.h +++ b/src/imports/statemachine/timeouttransition.h @@ -53,6 +53,7 @@ class TimeoutTransition : public QSignalTransition, public QQmlParserStatus Q_PROPERTY(int timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged) Q_INTERFACES(QQmlParserStatus) QML_ELEMENT + QML_ADDED_IN_VERSION(1, 0) public: TimeoutTransition(QState *parent = nullptr); diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index 20c5ce6418..380b7e38d7 100644 --- a/src/imports/testlib/TestCase.qml +++ b/src/imports/testlib/TestCase.qml @@ -198,7 +198,7 @@ import Qt.test.qtestroot 1.0 } \endcode - The mousePress(), mouseRelease(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence() + The mousePress(), mouseRelease(), mouseClick(), mouseDoubleClickSequence() and mouseMove() methods can be used to simulate mouse events in a similar fashion. @@ -1331,7 +1331,7 @@ Item { If \a item is obscured by another item, or a child of \a item occupies that position, then the event will be delivered to the other item instead. - \sa mouseRelease(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel() + \sa mouseRelease(), mouseClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel() */ function mousePress(item, x, y, button, modifiers, delay) { if (!qtest_verifyItem(item, "mousePress")) @@ -1365,7 +1365,7 @@ Item { If \a item is obscured by another item, or a child of \a item occupies that position, then the event will be delivered to the other item instead. - \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel() + \sa mousePress(), mouseClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel() */ function mouseRelease(item, x, y, button, modifiers, delay) { if (!qtest_verifyItem(item, "mouseRelease")) @@ -1398,7 +1398,7 @@ Item { If \a item is obscured by another item, or a child of \a item occupies that position, then the event will be delivered to the other item instead. - \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseRelease(), mouseWheel() + \sa mousePress(), mouseClick(), mouseDoubleClickSequence(), mouseMove(), mouseRelease(), mouseWheel() */ function mouseDrag(item, x, y, dx, dy, button, modifiers, delay) { if (!qtest_verifyItem(item, "mouseDrag")) @@ -1453,7 +1453,7 @@ Item { If \a item is obscured by another item, or a child of \a item occupies that position, then the event will be delivered to the other item instead. - \sa mousePress(), mouseRelease(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel() + \sa mousePress(), mouseRelease(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel() */ function mouseClick(item, x, y, button, modifiers, delay) { if (!qtest_verifyItem(item, "mouseClick")) @@ -1475,6 +1475,7 @@ Item { /*! \qmlmethod TestCase::mouseDoubleClick(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1) + \deprecated Simulates double-clicking a mouse \a button with optional \a modifiers on an \a item. The position of the click is defined by \a x and \a y. @@ -1528,7 +1529,7 @@ Item { This QML method was introduced in Qt 5.5. - \sa mouseDoubleClick(), mousePress(), mouseRelease(), mouseClick(), mouseMove(), mouseDrag(), mouseWheel() + \sa mousePress(), mouseRelease(), mouseClick(), mouseMove(), mouseDrag(), mouseWheel() */ function mouseDoubleClickSequence(item, x, y, button, modifiers, delay) { if (!qtest_verifyItem(item, "mouseDoubleClickSequence")) @@ -1560,7 +1561,7 @@ Item { If \a item is obscured by another item, or a child of \a item occupies that position, then the event will be delivered to the other item instead. - \sa mousePress(), mouseRelease(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseDrag(), mouseWheel() + \sa mousePress(), mouseRelease(), mouseClick(), mouseDoubleClickSequence(), mouseDrag(), mouseWheel() */ function mouseMove(item, x, y, delay, buttons) { if (!qtest_verifyItem(item, "mouseMove")) @@ -1588,7 +1589,7 @@ Item { The \a xDelta and \a yDelta contain the wheel rotation distance in eighths of a degree. see \l QWheelEvent::angleDelta() for more details. - \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseRelease(), mouseDrag(), QWheelEvent::angleDelta() + \sa mousePress(), mouseClick(), mouseDoubleClickSequence(), mouseMove(), mouseRelease(), mouseDrag(), QWheelEvent::angleDelta() */ function mouseWheel(item, x, y, xDelta, yDelta, buttons, modifiers, delay) { if (!qtest_verifyItem(item, "mouseWheel")) diff --git a/src/imports/testlib/dependencies.json b/src/imports/testlib/dependencies.json new file mode 100644 index 0000000000..b2c4125178 --- /dev/null +++ b/src/imports/testlib/dependencies.json @@ -0,0 +1 @@ +["QtQuick 2.0", "QtQuick.Window 2.0"] diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp index 1914c02dd0..83fc150e6c 100644 --- a/src/imports/testlib/main.cpp +++ b/src/imports/testlib/main.cpp @@ -50,6 +50,8 @@ QML_DECLARE_TYPE(QuickTestResult) QML_DECLARE_TYPE(QuickTestEvent) QML_DECLARE_TYPE(QuickTestUtil) +extern void qml_register_types_QtTest(); + QT_BEGIN_NAMESPACE class QTestQmlModule : public QQmlEngineExtensionPlugin @@ -58,7 +60,11 @@ class QTestQmlModule : public QQmlEngineExtensionPlugin Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) public: - QTestQmlModule(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { } + QTestQmlModule(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) + { + volatile auto registration = &qml_register_types_QtTest; + Q_UNUSED(registration); + } }; QT_END_NAMESPACE diff --git a/src/imports/testlib/quicktestevent_p.h b/src/imports/testlib/quicktestevent_p.h index f452e4ff82..0bbae8434f 100644 --- a/src/imports/testlib/quicktestevent_p.h +++ b/src/imports/testlib/quicktestevent_p.h @@ -63,6 +63,7 @@ class QQuickTouchEventSequence : public QObject { Q_OBJECT QML_ANONYMOUS + QML_ADDED_IN_VERSION(1, 0) public: explicit QQuickTouchEventSequence(QuickTestEvent *testEvent, QObject *item = nullptr); @@ -83,6 +84,7 @@ class QuickTestEvent : public QObject Q_OBJECT Q_PROPERTY(int defaultMouseDelay READ defaultMouseDelay FINAL) QML_NAMED_ELEMENT(TestEvent) + QML_ADDED_IN_VERSION(1, 0) public: QuickTestEvent(QObject *parent = nullptr); ~QuickTestEvent() override; @@ -97,7 +99,7 @@ public Q_SLOTS: bool keyReleaseChar(const QString &character, int modifiers, int delay); bool keyClickChar(const QString &character, int modifiers, int delay); - Q_REVISION(2) bool keySequence(const QVariant &keySequence); + Q_REVISION(1, 2) bool keySequence(const QVariant &keySequence); bool mousePress(QObject *item, qreal x, qreal y, int button, int modifiers, int delay); diff --git a/src/imports/testlib/quicktestresultforeign_p.h b/src/imports/testlib/quicktestresultforeign_p.h index 92ff8e8a5a..e9dd12fa93 100644 --- a/src/imports/testlib/quicktestresultforeign_p.h +++ b/src/imports/testlib/quicktestresultforeign_p.h @@ -61,6 +61,7 @@ struct QuickTestResultForeign Q_GADGET QML_FOREIGN(QuickTestResult) QML_NAMED_ELEMENT(TestResult) + QML_ADDED_IN_VERSION(1, 0) }; QT_END_NAMESPACE diff --git a/src/imports/testlib/quicktestutil_p.h b/src/imports/testlib/quicktestutil_p.h index 2456bf88a7..7e90c1cd1d 100644 --- a/src/imports/testlib/quicktestutil_p.h +++ b/src/imports/testlib/quicktestutil_p.h @@ -63,6 +63,7 @@ class QuickTestUtil : public QObject Q_PROPERTY(bool printAvailableFunctions READ printAvailableFunctions NOTIFY printAvailableFunctionsChanged) Q_PROPERTY(int dragThreshold READ dragThreshold NOTIFY dragThresholdChanged) QML_NAMED_ELEMENT(TestUtil) + QML_ADDED_IN_VERSION(1, 0) public: QuickTestUtil(QObject *parent = nullptr) :QObject(parent) {} ~QuickTestUtil() override {} diff --git a/src/imports/testlib/testlib.pro b/src/imports/testlib/testlib.pro index de6453eeab..2a97213e29 100644 --- a/src/imports/testlib/testlib.pro +++ b/src/imports/testlib/testlib.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = qmltestplugin TARGETPATH = QtTest -IMPORT_VERSION = 1.15 +QML_IMPORT_VERSION = $$QT_VERSION QT += quick qmltest-private qml-private core-private testlib gui-private diff --git a/src/imports/wavefrontmesh/plugin.cpp b/src/imports/wavefrontmesh/plugin.cpp index 9bb7a45b2f..eea0db19db 100644 --- a/src/imports/wavefrontmesh/plugin.cpp +++ b/src/imports/wavefrontmesh/plugin.cpp @@ -42,6 +42,8 @@ #include "qwavefrontmesh.h" +extern void qml_register_types_Qt_labs_wavefrontmesh(); + QT_BEGIN_NAMESPACE class QmlWavefrontMeshPlugin : public QQmlEngineExtensionPlugin @@ -52,6 +54,8 @@ public: QmlWavefrontMeshPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { + volatile auto registration = &qml_register_types_Qt_labs_wavefrontmesh; + Q_UNUSED(registration); } }; diff --git a/src/imports/wavefrontmesh/qwavefrontmesh.cpp b/src/imports/wavefrontmesh/qwavefrontmesh.cpp index e973ef0103..1772c40c50 100644 --- a/src/imports/wavefrontmesh/qwavefrontmesh.cpp +++ b/src/imports/wavefrontmesh/qwavefrontmesh.cpp @@ -257,7 +257,7 @@ void QWavefrontMesh::readData() while (!stream.atEnd()) { stream.readLineInto(&buffer); - QVector<QStringRef> tokens = buffer.splitRef(space, QString::SkipEmptyParts); + QVector<QStringRef> tokens = buffer.splitRef(space, Qt::SkipEmptyParts); if (tokens.size() < 2) continue; @@ -316,7 +316,7 @@ void QWavefrontMesh::readData() if (tokens.size() >= 4 && tokens.size() <= 5) { { bool ok; - QVector<QStringRef> faceTokens = tokens.at(1).split(slash, QString::SkipEmptyParts); + QVector<QStringRef> faceTokens = tokens.at(1).split(slash, Qt::SkipEmptyParts); Q_ASSERT(!faceTokens.isEmpty()); p1 = faceTokens.at(0).toInt(&ok) - 1; @@ -336,7 +336,7 @@ void QWavefrontMesh::readData() { bool ok; - QVector<QStringRef> faceTokens = tokens.at(2).split(slash, QString::SkipEmptyParts); + QVector<QStringRef> faceTokens = tokens.at(2).split(slash, Qt::SkipEmptyParts); Q_ASSERT(!faceTokens.isEmpty()); p2 = faceTokens.at(0).toInt(&ok) - 1; @@ -356,7 +356,7 @@ void QWavefrontMesh::readData() { bool ok; - QVector<QStringRef> faceTokens = tokens.at(3).split(slash, QString::SkipEmptyParts); + QVector<QStringRef> faceTokens = tokens.at(3).split(slash, Qt::SkipEmptyParts); Q_ASSERT(!faceTokens.isEmpty()); p3 = faceTokens.at(0).toInt(&ok) - 1; @@ -394,7 +394,7 @@ void QWavefrontMesh::readData() if (tokens.size() == 5) { bool ok; - QVector<QStringRef> faceTokens = tokens.at(4).split(slash, QString::SkipEmptyParts); + QVector<QStringRef> faceTokens = tokens.at(4).split(slash, Qt::SkipEmptyParts); Q_ASSERT(!faceTokens.isEmpty()); int p4 = faceTokens.at(0).toInt(&ok) - 1; diff --git a/src/imports/wavefrontmesh/qwavefrontmesh.h b/src/imports/wavefrontmesh/qwavefrontmesh.h index a8a40c1a6a..67e0527e5d 100644 --- a/src/imports/wavefrontmesh/qwavefrontmesh.h +++ b/src/imports/wavefrontmesh/qwavefrontmesh.h @@ -56,6 +56,7 @@ class QWavefrontMesh : public QQuickShaderEffectMesh Q_PROPERTY(QVector3D projectionPlaneV READ projectionPlaneV WRITE setProjectionPlaneV NOTIFY projectionPlaneVChanged) Q_PROPERTY(QVector3D projectionPlaneW READ projectionPlaneW WRITE setProjectionPlaneW NOTIFY projectionPlaneWChanged) QML_NAMED_ELEMENT(WavefrontMesh) + QML_ADDED_IN_VERSION(1, 0) public: enum Error { diff --git a/src/imports/wavefrontmesh/wavefrontmesh.pro b/src/imports/wavefrontmesh/wavefrontmesh.pro index f6d93b867d..4aa06b97bf 100644 --- a/src/imports/wavefrontmesh/wavefrontmesh.pro +++ b/src/imports/wavefrontmesh/wavefrontmesh.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = qmlwavefrontmeshplugin TARGETPATH = Qt/labs/wavefrontmesh -IMPORT_VERSION = 1.15 +QML_IMPORT_VERSION = $$QT_VERSION QT = core-private qml-private quick-private diff --git a/src/imports/window/plugin.cpp b/src/imports/window/plugin.cpp index ec4f2c5d2a..5152fa02ec 100644 --- a/src/imports/window/plugin.cpp +++ b/src/imports/window/plugin.cpp @@ -41,6 +41,8 @@ #include "plugin.h" +extern void qml_register_types_QtQuick_Window(); + QT_BEGIN_NAMESPACE /*! @@ -64,7 +66,11 @@ class QtQuick2WindowPlugin : public QQmlEngineExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) public: - QtQuick2WindowPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { } + QtQuick2WindowPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) + { + volatile auto registration = &qml_register_types_QtQuick_Window; + Q_UNUSED(registration); + } }; //![class decl] diff --git a/src/imports/window/plugin.h b/src/imports/window/plugin.h index 9f58ca9ac7..625a77b12c 100644 --- a/src/imports/window/plugin.h +++ b/src/imports/window/plugin.h @@ -65,7 +65,7 @@ struct QWindowForeign Q_GADGET QML_FOREIGN(QWindow) QML_ANONYMOUS - QML_ADDED_IN_MINOR_VERSION(1) + QML_ADDED_IN_VERSION(2, 1) }; struct QQuickWindowForeign @@ -73,8 +73,8 @@ struct QQuickWindowForeign Q_GADGET QML_FOREIGN(QQuickWindow) QML_NAMED_ELEMENT(Window) - QML_ADDED_IN_MINOR_VERSION(0) - QML_REMOVED_IN_MINOR_VERSION(1) + QML_ADDED_IN_VERSION(2, 0) + QML_REMOVED_IN_VERSION(2, 1) }; struct QQuickWindowForeignAttached @@ -82,6 +82,7 @@ struct QQuickWindowForeignAttached Q_GADGET QML_FOREIGN(QQuickWindowAttached) QML_ANONYMOUS + QML_ADDED_IN_VERSION(2, 0) }; struct QQuickScreenInfoForeign @@ -89,7 +90,7 @@ struct QQuickScreenInfoForeign Q_GADGET QML_FOREIGN(QQuickScreenInfo) QML_NAMED_ELEMENT(ScreenInfo) - QML_ADDED_IN_MINOR_VERSION(3) + QML_ADDED_IN_VERSION(2, 3) QML_UNCREATABLE("ScreenInfo can only be used via the attached property.") }; @@ -98,6 +99,7 @@ struct QQuickScreenForeignAttached Q_GADGET QML_FOREIGN(QQuickScreenAttached) QML_ANONYMOUS + QML_ADDED_IN_VERSION(2, 0) }; struct QQuickScreenForeign @@ -105,6 +107,7 @@ struct QQuickScreenForeign Q_GADGET QML_FOREIGN(QQuickScreen) QML_NAMED_ELEMENT(Screen) + QML_ADDED_IN_VERSION(2, 0) QML_UNCREATABLE("Screen can only be used via the attached property.") }; @@ -113,7 +116,14 @@ struct QQuickWindowQmlImplForeign Q_GADGET QML_FOREIGN(QQuickWindowQmlImpl) QML_NAMED_ELEMENT(Window) - QML_ADDED_IN_MINOR_VERSION(1) + QML_ADDED_IN_VERSION(2, 1) +}; + +struct QQuickRootItemForeign +{ + Q_GADGET + QML_FOREIGN(QQuickRootItem) + QML_ANONYMOUS }; QT_END_NAMESPACE diff --git a/src/imports/window/window.pro b/src/imports/window/window.pro index 70af305937..d8f9b16df4 100644 --- a/src/imports/window/window.pro +++ b/src/imports/window/window.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = windowplugin TARGETPATH = QtQuick/Window -IMPORT_VERSION = 2.15 +QML_IMPORT_VERSION = $$QT_VERSION SOURCES += \ plugin.cpp diff --git a/src/imports/workerscript/dependencies.json b/src/imports/workerscript/dependencies.json deleted file mode 100644 index 0d4f101c7a..0000000000 --- a/src/imports/workerscript/dependencies.json +++ /dev/null @@ -1,2 +0,0 @@ -[ -] diff --git a/src/imports/workerscript/plugin.cpp b/src/imports/workerscript/plugin.cpp index 0961979c53..1323b17ef4 100644 --- a/src/imports/workerscript/plugin.cpp +++ b/src/imports/workerscript/plugin.cpp @@ -37,17 +37,11 @@ ** ****************************************************************************/ -#include <QtQmlWorkerScript/private/qquickworkerscript_p.h> - +#include <QtQmlWorkerScript/private/qtqmlworkerscriptglobal_p.h> #include <QtQml/qqmlextensionplugin.h> -#include <QtQml/qqml.h> - -#include <QtCore/qloggingcategory.h> QT_BEGIN_NAMESPACE -Q_LOGGING_CATEGORY(workerScriptPlugin, "qt.workerScriptPlugin") - /*! \qmlmodule QtQml.WorkerScript 2.\QtMinorVersion \title Qt QML WorkerScript QML Types @@ -71,13 +65,8 @@ class QtQmlWorkerScriptPlugin : public QQmlEngineExtensionPlugin public: QtQmlWorkerScriptPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { - if (workerScriptPlugin().isDebugEnabled()) { - // Superficial debug message that causes the dependency between QtQmlWorkerScript - // and the workerscript plugin to be retained. - // As qCDebug() can be a noop, retrieve the className in a separate step. - const QString className = QQuickWorkerScript::staticMetaObject.className(); - qCDebug(workerScriptPlugin) << "Loading WorkerScript plugin:" << className; - } + volatile auto registration = &qml_register_types_QtQml_WorkerScript; + Q_UNUSED(registration); } }; diff --git a/src/imports/workerscript/workerscript.pro b/src/imports/workerscript/workerscript.pro index 101442c3f3..9c6a65eb05 100644 --- a/src/imports/workerscript/workerscript.pro +++ b/src/imports/workerscript/workerscript.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = workerscriptplugin TARGETPATH = QtQml/WorkerScript -IMPORT_VERSION = 2.15 +QML_IMPORT_VERSION = $$QT_VERSION SOURCES += \ plugin.cpp |