diff options
Diffstat (limited to 'src')
179 files changed, 2194 insertions, 787 deletions
diff --git a/src/imports/folderlistmodel/plugin.cpp b/src/imports/folderlistmodel/plugin.cpp index 31cd793737..ebce18a6e2 100644 --- a/src/imports/folderlistmodel/plugin.cpp +++ b/src/imports/folderlistmodel/plugin.cpp @@ -55,19 +55,14 @@ public: void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.folderlistmodel")); - qmlRegisterType<QQuickFolderListModel>(uri,1,0,"FolderListModel"); - qmlRegisterType<QQuickFolderListModel>(uri,2,0,"FolderListModel"); - qmlRegisterType<QQuickFolderListModel,1>(uri,2,1,"FolderListModel"); - qmlRegisterType<QQuickFolderListModel,2>(uri,2,2,"FolderListModel"); - // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward - qmlRegisterModule(uri, 2, QT_VERSION_MINOR); + // Major version 1 only has a single revision, 0. + qmlRegisterType<QQuickFolderListModel>(uri, 1, 0, "FolderListModel"); - // revision in Qt 5.11: added status property - qmlRegisterType<QQuickFolderListModel,11>(uri, 2, 11, "FolderListModel"); + qmlRegisterTypesAndRevisions<QQuickFolderListModel>(uri, 2); - // revision in Qt 5.12: added sortCaseSensitive property - qmlRegisterType<QQuickFolderListModel,12>(uri, 2, 12, "FolderListModel"); + // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward + qmlRegisterModule(uri, 2, QT_VERSION_MINOR); } }; //![class decl] diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.h b/src/imports/folderlistmodel/qquickfolderlistmodel.h index d93e7daf3f..5897bd2e0f 100644 --- a/src/imports/folderlistmodel/qquickfolderlistmodel.h +++ b/src/imports/folderlistmodel/qquickfolderlistmodel.h @@ -79,6 +79,7 @@ class QQuickFolderListModel : public QAbstractListModel, public QQmlParserStatus Q_PROPERTY(bool sortCaseSensitive READ sortCaseSensitive WRITE setSortCaseSensitive REVISION 12) //![class props] + QML_NAMED_ELEMENT(FolderListModel) //![abslistmodel] public: QQuickFolderListModel(QObject *parent = nullptr); diff --git a/src/imports/labsanimation/plugin.cpp b/src/imports/labsanimation/plugin.cpp index d8c0c071ca..7b84cf59f2 100644 --- a/src/imports/labsanimation/plugin.cpp +++ b/src/imports/labsanimation/plugin.cpp @@ -70,7 +70,7 @@ public: void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.animation")); - qmlRegisterType<QQuickBoundaryRule>(uri, 1, 0, "BoundaryRule"); + qmlRegisterTypesAndRevisions<QQuickBoundaryRule>(uri, 1); qmlRegisterModule(uri, 1, 0); } }; diff --git a/src/imports/layouts/plugin.cpp b/src/imports/layouts/plugin.cpp index d28109c3cf..93b95e1c1e 100644 --- a/src/imports/layouts/plugin.cpp +++ b/src/imports/layouts/plugin.cpp @@ -57,15 +57,8 @@ public: { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Layouts")); - qmlRegisterType<QQuickRowLayout>(uri, 1, 0, "RowLayout"); - qmlRegisterType<QQuickColumnLayout>(uri, 1, 0, "ColumnLayout"); - qmlRegisterType<QQuickGridLayout>(uri, 1, 0, "GridLayout"); - qmlRegisterType<QQuickStackLayout>(uri, 1, 3, "StackLayout"); - qmlRegisterUncreatableType<QQuickLayout>(uri, 1, 0, "Layout", - QStringLiteral("Do not create objects of type Layout")); - qmlRegisterUncreatableType<QQuickLayout>(uri, 1, 2, "Layout", - QStringLiteral("Do not create objects of type Layout")); - qmlRegisterRevision<QQuickGridLayoutBase, 1>(uri, 1, 1); + qmlRegisterTypesAndRevisions<QQuickRowLayout, QQuickColumnLayout, QQuickGridLayout, + QQuickStackLayout, QQuickLayout, QQuickGridLayoutBase>(uri, 1); // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward qmlRegisterModule(uri, 1, QT_VERSION_MINOR); diff --git a/src/imports/layouts/plugins.qmltypes b/src/imports/layouts/plugins.qmltypes index 6015164511..4ebef4ac51 100644 --- a/src/imports/layouts/plugins.qmltypes +++ b/src/imports/layouts/plugins.qmltypes @@ -12,15 +12,27 @@ Module { name: "QQuickColumnLayout" defaultProperty: "data" prototype: "QQuickLinearLayout" - exports: ["QtQuick.Layouts/ColumnLayout 1.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Layouts/ColumnLayout 1.0", + "QtQuick.Layouts/ColumnLayout 1.1", + "QtQuick.Layouts/ColumnLayout 1.11", + "QtQuick.Layouts/ColumnLayout 1.4", + "QtQuick.Layouts/ColumnLayout 1.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] } Component { name: "QQuickGridLayout" defaultProperty: "data" prototype: "QQuickGridLayoutBase" - exports: ["QtQuick.Layouts/GridLayout 1.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Layouts/GridLayout 1.0", + "QtQuick.Layouts/GridLayout 1.1", + "QtQuick.Layouts/GridLayout 1.11", + "QtQuick.Layouts/GridLayout 1.4", + "QtQuick.Layouts/GridLayout 1.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Enum { name: "Flow" values: { @@ -45,9 +57,15 @@ Module { name: "QQuickLayout" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick.Layouts/Layout 1.0", "QtQuick.Layouts/Layout 1.2"] + exports: [ + "QtQuick.Layouts/Layout 1.0", + "QtQuick.Layouts/Layout 1.1", + "QtQuick.Layouts/Layout 1.11", + "QtQuick.Layouts/Layout 1.4", + "QtQuick.Layouts/Layout 1.7" + ] isCreatable: false - exportMetaObjectRevisions: [0, 0] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] attachedType: "QQuickLayoutAttached" } Component { @@ -82,15 +100,26 @@ Module { name: "QQuickRowLayout" defaultProperty: "data" prototype: "QQuickLinearLayout" - exports: ["QtQuick.Layouts/RowLayout 1.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Layouts/RowLayout 1.0", + "QtQuick.Layouts/RowLayout 1.1", + "QtQuick.Layouts/RowLayout 1.11", + "QtQuick.Layouts/RowLayout 1.4", + "QtQuick.Layouts/RowLayout 1.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] } Component { name: "QQuickStackLayout" defaultProperty: "data" prototype: "QQuickLayout" - exports: ["QtQuick.Layouts/StackLayout 1.3"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Layouts/StackLayout 1.11", + "QtQuick.Layouts/StackLayout 1.3", + "QtQuick.Layouts/StackLayout 1.4", + "QtQuick.Layouts/StackLayout 1.7" + ] + exportMetaObjectRevisions: [11, 3, 4, 7] Property { name: "count"; type: "int"; isReadonly: true } Property { name: "currentIndex"; type: "int" } Method { diff --git a/src/imports/layouts/qquicklayout_p.h b/src/imports/layouts/qquicklayout_p.h index b31bffa290..c022a2fd47 100644 --- a/src/imports/layouts/qquicklayout_p.h +++ b/src/imports/layouts/qquicklayout_p.h @@ -61,6 +61,10 @@ class QQuickLayout : public QQuickItem, public QQuickItemChangeListener { Q_OBJECT + QML_NAMED_ELEMENT(Layout) + QML_UNCREATABLE("Do not create objects of type Layout.") + QML_ATTACHED(QQuickLayoutAttached) + public: enum SizeHint { MinimumSize = 0, @@ -331,6 +335,5 @@ inline QQuickLayoutAttached *attachedLayoutObject(QQuickItem *item, bool create QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickLayout) -QML_DECLARE_TYPEINFO(QQuickLayout, QML_HAS_ATTACHED_PROPERTIES) #endif // QQUICKLAYOUT_P_H diff --git a/src/imports/layouts/qquicklinearlayout_p.h b/src/imports/layouts/qquicklinearlayout_p.h index 6706ebf9fa..634e51a048 100644 --- a/src/imports/layouts/qquicklinearlayout_p.h +++ b/src/imports/layouts/qquicklinearlayout_p.h @@ -57,6 +57,8 @@ class QQuickGridLayoutBase : public QQuickLayout Q_OBJECT Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) + QML_ANONYMOUS + QML_ADDED_IN_MINOR_VERSION(1) public: @@ -140,6 +142,7 @@ class QQuickGridLayout : public QQuickGridLayoutBase Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged) Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowsChanged) Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) + QML_NAMED_ELEMENT(GridLayout) public: explicit QQuickGridLayout(QQuickItem *parent = 0); qreal columnSpacing() const; @@ -223,6 +226,7 @@ public: class QQuickRowLayout : public QQuickLinearLayout { Q_OBJECT + QML_NAMED_ELEMENT(RowLayout) public: explicit QQuickRowLayout(QQuickItem *parent = 0) @@ -238,6 +242,7 @@ public: class QQuickColumnLayout : public QQuickLinearLayout { Q_OBJECT + QML_NAMED_ELEMENT(ColumnLayout) public: explicit QQuickColumnLayout(QQuickItem *parent = 0) diff --git a/src/imports/layouts/qquickstacklayout_p.h b/src/imports/layouts/qquickstacklayout_p.h index 46181c6f50..537d54900f 100644 --- a/src/imports/layouts/qquickstacklayout_p.h +++ b/src/imports/layouts/qquickstacklayout_p.h @@ -51,6 +51,8 @@ class QQuickStackLayout : public QQuickLayout Q_OBJECT 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) public: explicit QQuickStackLayout(QQuickItem *parent = 0); diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index 9004d1ee6f..1ee9d461b4 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -716,6 +716,8 @@ Returns the created database object. class QQuickLocalStorage : public QObject { Q_OBJECT + QML_NAMED_ELEMENT(LocalStorage) + QML_SINGLETON public: QQuickLocalStorage(QObject *parent=nullptr) : QObject(parent) { @@ -802,15 +804,6 @@ void QQuickLocalStorage::openDatabaseSync(QQmlV4Function *args) #endif // settings } -static QObject *module_api_factory(QQmlEngine *engine, QJSEngine *scriptEngine) -{ - Q_UNUSED(engine) - Q_UNUSED(scriptEngine) - QQuickLocalStorage *api = new QQuickLocalStorage(); - - return api; -} - class QQmlLocalStoragePlugin : public QQmlExtensionPlugin { Q_OBJECT @@ -823,7 +816,7 @@ public: void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.LocalStorage")); - qmlRegisterSingletonType<QQuickLocalStorage>(uri, 2, 0, "LocalStorage", module_api_factory); + qmlRegisterTypesAndRevisions<QQuickLocalStorage>(uri, 2); // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward qmlRegisterModule(uri, 2, QT_VERSION_MINOR); diff --git a/src/imports/models/plugins.qmltypes b/src/imports/models/plugins.qmltypes index 0d8b94df23..0f8814d0cd 100644 --- a/src/imports/models/plugins.qmltypes +++ b/src/imports/models/plugins.qmltypes @@ -398,7 +398,7 @@ Module { defaultProperty: "delegate" prototype: "QQmlInstanceModel" exports: ["QtQml.Models/DelegateModel 2.1"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [1] attachedType: "QQmlDelegateModelAttached" Property { name: "model"; type: "QVariant" } Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } @@ -434,7 +434,7 @@ Module { name: "QQmlDelegateModelGroup" prototype: "QObject" exports: ["QtQml.Models/DelegateModelGroup 2.1"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [1] Property { name: "count"; type: "int"; isReadonly: true } Property { name: "name"; type: "string" } Property { name: "includeByDefault"; type: "bool" } @@ -487,13 +487,13 @@ Module { name: "QQmlListElement" prototype: "QObject" exports: ["QtQml.Models/ListElement 2.1"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [1] } Component { name: "QQmlListModel" prototype: "QAbstractListModel" - exports: ["QtQml.Models/ListModel 2.1"] - exportMetaObjectRevisions: [0] + exports: ["QtQml.Models/ListModel 2.1", "QtQml.Models/ListModel 2.14"] + exportMetaObjectRevisions: [1, 14] Property { name: "count"; type: "int"; isReadonly: true } Property { name: "dynamicRoles"; type: "bool" } Property { name: "agent"; revision: 14; type: "QObject"; isReadonly: true; isPointer: true } @@ -590,7 +590,7 @@ Module { "QtQml.Models/ObjectModel 2.1", "QtQml.Models/ObjectModel 2.3" ] - exportMetaObjectRevisions: [0, 3] + exportMetaObjectRevisions: [1, 3] attachedType: "QQmlObjectModelAttached" Property { name: "children"; type: "QObject"; isList: true; isReadonly: true } Method { name: "clear"; revision: 3 } @@ -646,7 +646,7 @@ Module { defaultProperty: "data" prototype: "QObject" exports: ["QtQml.Models/Package 2.14"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [14] attachedType: "QQuickPackageAttached" Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } } diff --git a/src/imports/particles/plugins.qmltypes b/src/imports/particles/plugins.qmltypes index 0fe5dc808c..4a11658f1f 100644 --- a/src/imports/particles/plugins.qmltypes +++ b/src/imports/particles/plugins.qmltypes @@ -12,8 +12,14 @@ Module { name: "QQuickAgeAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["QtQuick.Particles/Age 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Particles/Age 2.0", + "QtQuick.Particles/Age 2.1", + "QtQuick.Particles/Age 2.11", + "QtQuick.Particles/Age 2.4", + "QtQuick.Particles/Age 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Property { name: "lifeLeft"; type: "int" } Property { name: "advancePosition"; type: "bool" } Signal { @@ -79,8 +85,14 @@ Module { name: "QQuickAttractorAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["QtQuick.Particles/Attractor 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Particles/Attractor 2.0", + "QtQuick.Particles/Attractor 2.1", + "QtQuick.Particles/Attractor 2.11", + "QtQuick.Particles/Attractor 2.4", + "QtQuick.Particles/Attractor 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Enum { name: "Proportion" values: { @@ -157,8 +169,14 @@ Module { name: "QQuickCustomAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["QtQuick.Particles/Affector 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Particles/Affector 2.0", + "QtQuick.Particles/Affector 2.1", + "QtQuick.Particles/Affector 2.11", + "QtQuick.Particles/Affector 2.4", + "QtQuick.Particles/Affector 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Property { name: "relative"; type: "bool" } Property { name: "position"; type: "QQuickDirection"; isPointer: true } Property { name: "velocity"; type: "QQuickDirection"; isPointer: true } @@ -205,8 +223,14 @@ Module { name: "QQuickCustomParticle" defaultProperty: "data" prototype: "QQuickParticlePainter" - exports: ["QtQuick.Particles/CustomParticle 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Particles/CustomParticle 2.0", + "QtQuick.Particles/CustomParticle 2.1", + "QtQuick.Particles/CustomParticle 2.11", + "QtQuick.Particles/CustomParticle 2.4", + "QtQuick.Particles/CustomParticle 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Property { name: "fragmentShader"; type: "QByteArray" } Property { name: "vertexShader"; type: "QByteArray" } } @@ -236,8 +260,14 @@ Module { name: "QQuickFrictionAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["QtQuick.Particles/Friction 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Particles/Friction 2.0", + "QtQuick.Particles/Friction 2.1", + "QtQuick.Particles/Friction 2.11", + "QtQuick.Particles/Friction 2.4", + "QtQuick.Particles/Friction 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Property { name: "factor"; type: "double" } Property { name: "threshold"; type: "double" } Signal { @@ -261,8 +291,14 @@ Module { name: "QQuickGravityAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["QtQuick.Particles/Gravity 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Particles/Gravity 2.0", + "QtQuick.Particles/Gravity 2.1", + "QtQuick.Particles/Gravity 2.11", + "QtQuick.Particles/Gravity 2.4", + "QtQuick.Particles/Gravity 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Property { name: "magnitude"; type: "double" } Property { name: "acceleration"; type: "double" } Property { name: "angle"; type: "double" } @@ -291,8 +327,14 @@ Module { name: "QQuickGroupGoalAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["QtQuick.Particles/GroupGoal 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Particles/GroupGoal 2.0", + "QtQuick.Particles/GroupGoal 2.1", + "QtQuick.Particles/GroupGoal 2.11", + "QtQuick.Particles/GroupGoal 2.4", + "QtQuick.Particles/GroupGoal 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Property { name: "goalState"; type: "string" } Property { name: "jump"; type: "bool" } Signal { @@ -316,8 +358,14 @@ Module { name: "QQuickImageParticle" defaultProperty: "data" prototype: "QQuickParticlePainter" - exports: ["QtQuick.Particles/ImageParticle 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Particles/ImageParticle 2.0", + "QtQuick.Particles/ImageParticle 2.1", + "QtQuick.Particles/ImageParticle 2.11", + "QtQuick.Particles/ImageParticle 2.4", + "QtQuick.Particles/ImageParticle 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Enum { name: "Status" values: { @@ -495,8 +543,14 @@ Module { name: "QQuickItemParticle" defaultProperty: "data" prototype: "QQuickParticlePainter" - exports: ["QtQuick.Particles/ItemParticle 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Particles/ItemParticle 2.0", + "QtQuick.Particles/ItemParticle 2.1", + "QtQuick.Particles/ItemParticle 2.11", + "QtQuick.Particles/ItemParticle 2.4", + "QtQuick.Particles/ItemParticle 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] attachedType: "QQuickItemParticleAttached" Property { name: "fade"; type: "bool" } Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } @@ -575,9 +629,15 @@ Module { name: "QQuickParticleAffector" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick.Particles/ParticleAffector 2.0"] + exports: [ + "QtQuick.Particles/ParticleAffector 2.0", + "QtQuick.Particles/ParticleAffector 2.1", + "QtQuick.Particles/ParticleAffector 2.11", + "QtQuick.Particles/ParticleAffector 2.4", + "QtQuick.Particles/ParticleAffector 2.7" + ] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Property { name: "system"; type: "QQuickParticleSystem"; isPointer: true } Property { name: "groups"; type: "QStringList" } Property { name: "whenCollidingWith"; type: "QStringList" } @@ -643,8 +703,14 @@ Module { name: "QQuickParticleEmitter" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick.Particles/Emitter 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Particles/Emitter 2.0", + "QtQuick.Particles/Emitter 2.1", + "QtQuick.Particles/Emitter 2.11", + "QtQuick.Particles/Emitter 2.4", + "QtQuick.Particles/Emitter 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Enum { name: "Lifetime" values: { @@ -839,9 +905,15 @@ Module { name: "QQuickParticlePainter" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick.Particles/ParticlePainter 2.0"] + exports: [ + "QtQuick.Particles/ParticlePainter 2.0", + "QtQuick.Particles/ParticlePainter 2.1", + "QtQuick.Particles/ParticlePainter 2.11", + "QtQuick.Particles/ParticlePainter 2.4", + "QtQuick.Particles/ParticlePainter 2.7" + ] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Property { name: "system"; type: "QQuickParticleSystem"; isPointer: true } Property { name: "groups"; type: "QStringList" } Signal { name: "countChanged" } @@ -871,8 +943,14 @@ Module { name: "QQuickParticleSystem" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick.Particles/ParticleSystem 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Particles/ParticleSystem 2.0", + "QtQuick.Particles/ParticleSystem 2.1", + "QtQuick.Particles/ParticleSystem 2.11", + "QtQuick.Particles/ParticleSystem 2.4", + "QtQuick.Particles/ParticleSystem 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Property { name: "running"; type: "bool" } Property { name: "paused"; type: "bool" } Property { name: "empty"; type: "bool"; isReadonly: true } @@ -966,8 +1044,14 @@ Module { name: "QQuickSpriteGoalAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["QtQuick.Particles/SpriteGoal 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Particles/SpriteGoal 2.0", + "QtQuick.Particles/SpriteGoal 2.1", + "QtQuick.Particles/SpriteGoal 2.11", + "QtQuick.Particles/SpriteGoal 2.4", + "QtQuick.Particles/SpriteGoal 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Property { name: "goalState"; type: "string" } Property { name: "jump"; type: "bool" } Property { name: "systemStates"; type: "bool" } @@ -1069,8 +1153,14 @@ Module { name: "QQuickTrailEmitter" defaultProperty: "data" prototype: "QQuickParticleEmitter" - exports: ["QtQuick.Particles/TrailEmitter 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Particles/TrailEmitter 2.0", + "QtQuick.Particles/TrailEmitter 2.1", + "QtQuick.Particles/TrailEmitter 2.11", + "QtQuick.Particles/TrailEmitter 2.4", + "QtQuick.Particles/TrailEmitter 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Enum { name: "EmitSize" values: { @@ -1132,8 +1222,14 @@ Module { name: "QQuickTurbulenceAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["QtQuick.Particles/Turbulence 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Particles/Turbulence 2.0", + "QtQuick.Particles/Turbulence 2.1", + "QtQuick.Particles/Turbulence 2.11", + "QtQuick.Particles/Turbulence 2.4", + "QtQuick.Particles/Turbulence 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Property { name: "strength"; type: "double" } Property { name: "noiseSource"; type: "QUrl" } Signal { @@ -1157,8 +1253,14 @@ Module { name: "QQuickWanderAffector" defaultProperty: "data" prototype: "QQuickParticleAffector" - exports: ["QtQuick.Particles/Wander 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Particles/Wander 2.0", + "QtQuick.Particles/Wander 2.1", + "QtQuick.Particles/Wander 2.11", + "QtQuick.Particles/Wander 2.4", + "QtQuick.Particles/Wander 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Enum { name: "AffectableParameters" values: { diff --git a/src/imports/qtqml/plugins.qmltypes b/src/imports/qtqml/plugins.qmltypes index 63f5bada9b..ea8ef2b190 100644 --- a/src/imports/qtqml/plugins.qmltypes +++ b/src/imports/qtqml/plugins.qmltypes @@ -170,7 +170,7 @@ Module { name: "QQmlLocale" exports: ["QtQml/Locale 2.2"] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [2] Enum { name: "MeasurementSystem" values: { @@ -213,7 +213,7 @@ Module { name: "QQmlLoggingCategory" prototype: "QObject" exports: ["QtQml/LoggingCategory 2.12", "QtQml/LoggingCategory 2.8"] - exportMetaObjectRevisions: [12, 0] + exportMetaObjectRevisions: [12, 8] Enum { name: "DefaultLogLevel" values: { diff --git a/src/imports/qtquick2/plugins.qmltypes b/src/imports/qtquick2/plugins.qmltypes index c8aae2087d..89d2f45f00 100644 --- a/src/imports/qtquick2/plugins.qmltypes +++ b/src/imports/qtquick2/plugins.qmltypes @@ -935,8 +935,11 @@ Module { Component { name: "QQuickAnchorAnimation" prototype: "QQuickAbstractAnimation" - exports: ["QtQuick/AnchorAnimation 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/AnchorAnimation 2.0", + "QtQuick/AnchorAnimation 2.12" + ] + exportMetaObjectRevisions: [0, 12] Property { name: "targets"; type: "QQuickItem"; isList: true; isReadonly: true } Property { name: "duration"; type: "int" } Property { name: "easing"; type: "QEasingCurve" } @@ -1010,8 +1013,16 @@ Module { name: "QQuickAnimatedImage" defaultProperty: "data" prototype: "QQuickImage" - exports: ["QtQuick/AnimatedImage 2.0", "QtQuick/AnimatedImage 2.11"] - exportMetaObjectRevisions: [0, 11] + exports: [ + "QtQuick/AnimatedImage 2.0", + "QtQuick/AnimatedImage 2.1", + "QtQuick/AnimatedImage 2.11", + "QtQuick/AnimatedImage 2.3", + "QtQuick/AnimatedImage 2.4", + "QtQuick/AnimatedImage 2.5", + "QtQuick/AnimatedImage 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 3, 4, 5, 7] Property { name: "playing"; type: "bool" } Property { name: "paused"; type: "bool" } Property { name: "currentFrame"; type: "int" } @@ -1025,8 +1036,15 @@ Module { name: "QQuickAnimatedSprite" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick/AnimatedSprite 2.0", "QtQuick/AnimatedSprite 2.12"] - exportMetaObjectRevisions: [0, 12] + exports: [ + "QtQuick/AnimatedSprite 2.0", + "QtQuick/AnimatedSprite 2.1", + "QtQuick/AnimatedSprite 2.11", + "QtQuick/AnimatedSprite 2.12", + "QtQuick/AnimatedSprite 2.4", + "QtQuick/AnimatedSprite 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 12, 4, 7] Enum { name: "LoopParameters" values: { @@ -1203,9 +1221,9 @@ Module { Component { name: "QQuickAnimator" prototype: "QQuickAbstractAnimation" - exports: ["QtQuick/Animator 2.2"] + exports: ["QtQuick/Animator 2.12", "QtQuick/Animator 2.2"] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [12, 2] Property { name: "target"; type: "QQuickItem"; isPointer: true } Property { name: "easing"; type: "QEasingCurve" } Property { name: "duration"; type: "int" } @@ -1256,11 +1274,15 @@ Module { prototype: "QQuickImplicitSizeItem" exports: [ "QtQuick/Positioner 2.0", + "QtQuick/Positioner 2.1", + "QtQuick/Positioner 2.11", + "QtQuick/Positioner 2.4", "QtQuick/Positioner 2.6", + "QtQuick/Positioner 2.7", "QtQuick/Positioner 2.9" ] isCreatable: false - exportMetaObjectRevisions: [0, 6, 9] + exportMetaObjectRevisions: [0, 1, 11, 4, 6, 7, 9] attachedType: "QQuickPositionerAttached" Property { name: "spacing"; type: "double" } Property { name: "populate"; type: "QQuickTransition"; isPointer: true } @@ -1293,8 +1315,14 @@ Module { name: "QQuickBorderImage" defaultProperty: "data" prototype: "QQuickImageBase" - exports: ["QtQuick/BorderImage 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/BorderImage 2.0", + "QtQuick/BorderImage 2.1", + "QtQuick/BorderImage 2.11", + "QtQuick/BorderImage 2.4", + "QtQuick/BorderImage 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Enum { name: "TileMode" values: { @@ -1312,7 +1340,7 @@ Module { name: "QQuickBorderImageMesh" prototype: "QQuickShaderEffectMesh" exports: ["QtQuick/BorderImageMesh 2.8"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [8] Enum { name: "TileMode" values: { @@ -1330,8 +1358,14 @@ Module { name: "QQuickCanvasItem" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick/Canvas 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/Canvas 2.0", + "QtQuick/Canvas 2.1", + "QtQuick/Canvas 2.11", + "QtQuick/Canvas 2.4", + "QtQuick/Canvas 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Enum { name: "RenderTarget" values: { @@ -1422,8 +1456,8 @@ Module { Component { name: "QQuickColorAnimation" prototype: "QQuickPropertyAnimation" - exports: ["QtQuick/ColorAnimation 2.0"] - exportMetaObjectRevisions: [0] + exports: ["QtQuick/ColorAnimation 2.0", "QtQuick/ColorAnimation 2.12"] + exportMetaObjectRevisions: [0, 12] Property { name: "from"; type: "QColor" } Property { name: "to"; type: "QColor" } } @@ -1431,8 +1465,16 @@ Module { name: "QQuickColumn" defaultProperty: "data" prototype: "QQuickBasePositioner" - exports: ["QtQuick/Column 2.0", "QtQuick/Column 2.6"] - exportMetaObjectRevisions: [0, 6] + exports: [ + "QtQuick/Column 2.0", + "QtQuick/Column 2.1", + "QtQuick/Column 2.11", + "QtQuick/Column 2.4", + "QtQuick/Column 2.6", + "QtQuick/Column 2.7", + "QtQuick/Column 2.9" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 6, 7, 9] } Component { name: "QQuickCurve" @@ -1519,7 +1561,7 @@ Module { prototype: "QObject" exports: ["QtQuick/DragAxis 2.12"] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [12] Property { name: "minimum"; type: "double" } Property { name: "maximum"; type: "double" } Property { name: "enabled"; type: "bool" } @@ -1528,7 +1570,7 @@ Module { name: "QQuickDragHandler" prototype: "QQuickMultiPointHandler" exports: ["QtQuick/DragHandler 2.12"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [12] Enum { name: "SnapMode" values: { @@ -1547,8 +1589,14 @@ Module { name: "QQuickDropArea" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick/DropArea 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/DropArea 2.0", + "QtQuick/DropArea 2.1", + "QtQuick/DropArea 2.11", + "QtQuick/DropArea 2.4", + "QtQuick/DropArea 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Property { name: "containsDrag"; type: "bool"; isReadonly: true } Property { name: "keys"; type: "QStringList" } Property { name: "drag"; type: "QQuickDropAreaDrag"; isReadonly: true; isPointer: true } @@ -1625,7 +1673,7 @@ Module { prototype: "QObject" exports: ["QtQuick/EventPoint 2.12"] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [12] Enum { name: "States" values: { @@ -1664,7 +1712,7 @@ Module { prototype: "QQuickEventPoint" exports: ["QtQuick/EventTouchPoint 2.12"] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [12] Property { name: "rotation"; type: "double"; isReadonly: true } Property { name: "pressure"; type: "double"; isReadonly: true } Property { name: "ellipseDiameters"; type: "QSizeF"; isReadonly: true } @@ -1676,11 +1724,15 @@ Module { prototype: "QQuickItem" exports: [ "QtQuick/Flickable 2.0", + "QtQuick/Flickable 2.1", "QtQuick/Flickable 2.10", + "QtQuick/Flickable 2.11", "QtQuick/Flickable 2.12", + "QtQuick/Flickable 2.4", + "QtQuick/Flickable 2.7", "QtQuick/Flickable 2.9" ] - exportMetaObjectRevisions: [0, 10, 12, 9] + exportMetaObjectRevisions: [0, 1, 10, 11, 12, 4, 7, 9] Enum { name: "BoundsBehavior" values: { @@ -1805,8 +1857,14 @@ Module { name: "QQuickFlipable" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick/Flipable 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/Flipable 2.0", + "QtQuick/Flipable 2.1", + "QtQuick/Flipable 2.11", + "QtQuick/Flipable 2.4", + "QtQuick/Flipable 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Enum { name: "Side" values: { @@ -1822,8 +1880,16 @@ Module { name: "QQuickFlow" defaultProperty: "data" prototype: "QQuickBasePositioner" - exports: ["QtQuick/Flow 2.0", "QtQuick/Flow 2.6"] - exportMetaObjectRevisions: [0, 6] + exports: [ + "QtQuick/Flow 2.0", + "QtQuick/Flow 2.1", + "QtQuick/Flow 2.11", + "QtQuick/Flow 2.4", + "QtQuick/Flow 2.6", + "QtQuick/Flow 2.7", + "QtQuick/Flow 2.9" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 6, 7, 9] Enum { name: "Flow" values: { @@ -1839,8 +1905,14 @@ Module { name: "QQuickFocusScope" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick/FocusScope 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/FocusScope 2.0", + "QtQuick/FocusScope 2.1", + "QtQuick/FocusScope 2.11", + "QtQuick/FocusScope 2.4", + "QtQuick/FocusScope 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] } Component { name: "QQuickFontLoader" @@ -1864,7 +1936,7 @@ Module { name: "QQuickFontMetrics" prototype: "QObject" exports: ["QtQuick/FontMetrics 2.4"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [4] Property { name: "font"; type: "QFont" } Property { name: "ascent"; type: "double"; isReadonly: true } Property { name: "descent"; type: "double"; isReadonly: true } @@ -2011,7 +2083,7 @@ Module { prototype: "QObject" exports: ["QtQuick/GraphicsInfo 2.8"] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [8] Enum { name: "GraphicsApi" values: { @@ -2080,8 +2152,16 @@ Module { name: "QQuickGrid" defaultProperty: "data" prototype: "QQuickBasePositioner" - exports: ["QtQuick/Grid 2.0", "QtQuick/Grid 2.1", "QtQuick/Grid 2.6"] - exportMetaObjectRevisions: [0, 1, 6] + exports: [ + "QtQuick/Grid 2.0", + "QtQuick/Grid 2.1", + "QtQuick/Grid 2.11", + "QtQuick/Grid 2.4", + "QtQuick/Grid 2.6", + "QtQuick/Grid 2.7", + "QtQuick/Grid 2.9" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 6, 7, 9] Enum { name: "Flow" values: { @@ -2150,10 +2230,16 @@ Module { exports: [ "QtQuick/GridView 2.0", "QtQuick/GridView 2.1", + "QtQuick/GridView 2.10", + "QtQuick/GridView 2.11", + "QtQuick/GridView 2.12", "QtQuick/GridView 2.13", - "QtQuick/GridView 2.7" + "QtQuick/GridView 2.3", + "QtQuick/GridView 2.4", + "QtQuick/GridView 2.7", + "QtQuick/GridView 2.9" ] - exportMetaObjectRevisions: [0, 1, 13, 7] + exportMetaObjectRevisions: [0, 1, 10, 11, 12, 13, 3, 4, 7, 9] attachedType: "QQuickGridViewAttached" Enum { name: "Flow" @@ -2185,7 +2271,7 @@ Module { name: "QQuickHoverHandler" prototype: "QQuickSinglePointHandler" exports: ["QtQuick/HoverHandler 2.12"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [12] Property { name: "hovered"; type: "bool"; isReadonly: true } } Component { @@ -2194,10 +2280,14 @@ Module { prototype: "QQuickImageBase" exports: [ "QtQuick/Image 2.0", + "QtQuick/Image 2.1", + "QtQuick/Image 2.11", "QtQuick/Image 2.3", - "QtQuick/Image 2.5" + "QtQuick/Image 2.4", + "QtQuick/Image 2.5", + "QtQuick/Image 2.7" ] - exportMetaObjectRevisions: [0, 3, 5] + exportMetaObjectRevisions: [0, 1, 11, 3, 4, 5, 7] Enum { name: "HAlignment" values: { @@ -2563,12 +2653,17 @@ Module { prototype: "QQuickFlickable" exports: [ "QtQuick/ItemView 2.1", + "QtQuick/ItemView 2.10", + "QtQuick/ItemView 2.11", + "QtQuick/ItemView 2.12", "QtQuick/ItemView 2.13", "QtQuick/ItemView 2.3", - "QtQuick/ItemView 2.7" + "QtQuick/ItemView 2.4", + "QtQuick/ItemView 2.7", + "QtQuick/ItemView 2.9" ] isCreatable: false - exportMetaObjectRevisions: [1, 13, 3, 7] + exportMetaObjectRevisions: [1, 10, 11, 12, 13, 3, 4, 7, 9] Enum { name: "LayoutDirection" values: { @@ -2921,10 +3016,16 @@ Module { exports: [ "QtQuick/ListView 2.0", "QtQuick/ListView 2.1", + "QtQuick/ListView 2.10", + "QtQuick/ListView 2.11", + "QtQuick/ListView 2.12", + "QtQuick/ListView 2.13", + "QtQuick/ListView 2.3", "QtQuick/ListView 2.4", - "QtQuick/ListView 2.7" + "QtQuick/ListView 2.7", + "QtQuick/ListView 2.9" ] - exportMetaObjectRevisions: [0, 1, 4, 7] + exportMetaObjectRevisions: [0, 1, 10, 11, 12, 13, 3, 4, 7, 9] attachedType: "QQuickListViewAttached" Enum { name: "Orientation" @@ -2977,8 +3078,14 @@ Module { name: "QQuickLoader" defaultProperty: "data" prototype: "QQuickImplicitSizeItem" - exports: ["QtQuick/Loader 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/Loader 2.0", + "QtQuick/Loader 2.1", + "QtQuick/Loader 2.11", + "QtQuick/Loader 2.4", + "QtQuick/Loader 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Enum { name: "Status" values: { @@ -3005,7 +3112,7 @@ Module { name: "QQuickMatrix4x4" prototype: "QQuickTransform" exports: ["QtQuick/Matrix4x4 2.3"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [3] Property { name: "matrix"; type: "QMatrix4x4" } } Component { @@ -3014,11 +3121,14 @@ Module { prototype: "QQuickItem" exports: [ "QtQuick/MouseArea 2.0", + "QtQuick/MouseArea 2.1", + "QtQuick/MouseArea 2.11", "QtQuick/MouseArea 2.4", "QtQuick/MouseArea 2.5", + "QtQuick/MouseArea 2.7", "QtQuick/MouseArea 2.9" ] - exportMetaObjectRevisions: [0, 4, 5, 9] + exportMetaObjectRevisions: [0, 1, 11, 4, 5, 7, 9] Property { name: "mouseX"; type: "double"; isReadonly: true } Property { name: "mouseY"; type: "double"; isReadonly: true } Property { name: "containsMouse"; type: "bool"; isReadonly: true } @@ -3090,8 +3200,14 @@ Module { name: "QQuickMultiPointTouchArea" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick/MultiPointTouchArea 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/MultiPointTouchArea 2.0", + "QtQuick/MultiPointTouchArea 2.1", + "QtQuick/MultiPointTouchArea 2.11", + "QtQuick/MultiPointTouchArea 2.4", + "QtQuick/MultiPointTouchArea 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Property { name: "touchPoints"; type: "QQuickTouchPoint"; isList: true; isReadonly: true } Property { name: "minimumTouchPoints"; type: "int" } Property { name: "maximumTouchPoints"; type: "int" } @@ -3124,23 +3240,29 @@ Module { Component { name: "QQuickNumberAnimation" prototype: "QQuickPropertyAnimation" - exports: ["QtQuick/NumberAnimation 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/NumberAnimation 2.0", + "QtQuick/NumberAnimation 2.12" + ] + exportMetaObjectRevisions: [0, 12] Property { name: "from"; type: "double" } Property { name: "to"; type: "double" } } Component { name: "QQuickOpacityAnimator" prototype: "QQuickAnimator" - exports: ["QtQuick/OpacityAnimator 2.2"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/OpacityAnimator 2.12", + "QtQuick/OpacityAnimator 2.2" + ] + exportMetaObjectRevisions: [12, 2] } Component { name: "QQuickOpenGLInfo" prototype: "QObject" exports: ["QtQuick/OpenGLInfo 2.4"] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [4] Enum { name: "ContextProfile" values: { @@ -3180,9 +3302,15 @@ Module { name: "QQuickPaintedItem" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick/PaintedItem 2.0"] + exports: [ + "QtQuick/PaintedItem 2.0", + "QtQuick/PaintedItem 2.1", + "QtQuick/PaintedItem 2.11", + "QtQuick/PaintedItem 2.4", + "QtQuick/PaintedItem 2.7" + ] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Enum { name: "RenderTarget" values: { @@ -3207,15 +3335,21 @@ Module { name: "QQuickParallelAnimation" defaultProperty: "animations" prototype: "QQuickAnimationGroup" - exports: ["QtQuick/ParallelAnimation 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/ParallelAnimation 2.0", + "QtQuick/ParallelAnimation 2.12" + ] + exportMetaObjectRevisions: [0, 12] } Component { name: "QQuickParentAnimation" defaultProperty: "animations" prototype: "QQuickAnimationGroup" - exports: ["QtQuick/ParentAnimation 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/ParentAnimation 2.0", + "QtQuick/ParentAnimation 2.12" + ] + exportMetaObjectRevisions: [0, 12] Property { name: "target"; type: "QQuickItem"; isPointer: true } Property { name: "newParent"; type: "QQuickItem"; isPointer: true } Property { name: "via"; type: "QQuickItem"; isPointer: true } @@ -3258,7 +3392,7 @@ Module { name: "QQuickPathAngleArc" prototype: "QQuickCurve" exports: ["QtQuick/PathAngleArc 2.11"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [11] Property { name: "centerX"; type: "double" } Property { name: "centerY"; type: "double" } Property { name: "radiusX"; type: "double" } @@ -3270,8 +3404,8 @@ Module { Component { name: "QQuickPathAnimation" prototype: "QQuickAbstractAnimation" - exports: ["QtQuick/PathAnimation 2.0"] - exportMetaObjectRevisions: [0] + exports: ["QtQuick/PathAnimation 2.0", "QtQuick/PathAnimation 2.12"] + exportMetaObjectRevisions: [0, 12] Enum { name: "Orientation" values: { @@ -3393,13 +3527,13 @@ Module { name: "QQuickPathMove" prototype: "QQuickCurve" exports: ["QtQuick/PathMove 2.9"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [9] } Component { name: "QQuickPathMultiline" prototype: "QQuickCurve" exports: ["QtQuick/PathMultiline 2.14"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [14] Property { name: "start"; type: "QPointF"; isReadonly: true } Property { name: "paths"; type: "QVariantList" } } @@ -3414,7 +3548,7 @@ Module { name: "QQuickPathPolyline" prototype: "QQuickCurve" exports: ["QtQuick/PathPolyline 2.14"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [14] Property { name: "start"; type: "QPointF"; isReadonly: true } Property { name: "path"; type: "QVariantList" } } @@ -3441,10 +3575,13 @@ Module { prototype: "QQuickItem" exports: [ "QtQuick/PathView 2.0", + "QtQuick/PathView 2.1", + "QtQuick/PathView 2.11", "QtQuick/PathView 2.13", + "QtQuick/PathView 2.4", "QtQuick/PathView 2.7" ] - exportMetaObjectRevisions: [0, 13, 7] + exportMetaObjectRevisions: [0, 1, 11, 13, 4, 7] attachedType: "QQuickPathViewAttached" Enum { name: "HighlightRangeMode" @@ -3550,8 +3687,8 @@ Module { Component { name: "QQuickPauseAnimation" prototype: "QQuickAbstractAnimation" - exports: ["QtQuick/PauseAnimation 2.0"] - exportMetaObjectRevisions: [0] + exports: ["QtQuick/PauseAnimation 2.0", "QtQuick/PauseAnimation 2.12"] + exportMetaObjectRevisions: [0, 12] Property { name: "duration"; type: "int" } Signal { name: "durationChanged" @@ -3597,8 +3734,15 @@ Module { name: "QQuickPinchArea" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick/PinchArea 2.0", "QtQuick/PinchArea 2.5"] - exportMetaObjectRevisions: [0, 5] + exports: [ + "QtQuick/PinchArea 2.0", + "QtQuick/PinchArea 2.1", + "QtQuick/PinchArea 2.11", + "QtQuick/PinchArea 2.4", + "QtQuick/PinchArea 2.5", + "QtQuick/PinchArea 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 5, 7] Property { name: "enabled"; type: "bool" } Property { name: "pinch"; type: "QQuickPinch"; isReadonly: true; isPointer: true } Signal { @@ -3641,7 +3785,7 @@ Module { name: "QQuickPinchHandler" prototype: "QQuickMultiPointHandler" exports: ["QtQuick/PinchHandler 2.12"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [12] Property { name: "minimumScale"; type: "double" } Property { name: "maximumScale"; type: "double" } Property { name: "minimumRotation"; type: "double" } @@ -3662,7 +3806,7 @@ Module { name: "QQuickPointHandler" prototype: "QQuickSinglePointHandler" exports: ["QtQuick/PointHandler 2.12"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [12] Property { name: "translation"; type: "QVector2D"; isReadonly: true } } Component { @@ -3670,7 +3814,7 @@ Module { prototype: "QObject" exports: ["QtQuick/PointerDevice 2.12"] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [12] Enum { name: "DeviceTypes" values: { @@ -3747,7 +3891,7 @@ Module { prototype: "QObject" exports: ["QtQuick/PointerEvent 2.12"] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [12] Property { name: "device"; type: "QQuickPointerDevice"; isReadonly: true; isPointer: true } Property { name: "modifiers"; type: "Qt::KeyboardModifiers"; isReadonly: true } Property { name: "button"; type: "Qt::MouseButtons"; isReadonly: true } @@ -3758,7 +3902,7 @@ Module { prototype: "QObject" exports: ["QtQuick/PointerHandler 2.12"] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [12] Enum { name: "GrabPermissions" values: { @@ -3796,14 +3940,14 @@ Module { prototype: "QQuickSinglePointEvent" exports: ["QtQuick/PointerMouseEvent 2.12"] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [12] } Component { name: "QQuickPointerTouchEvent" prototype: "QQuickPointerEvent" exports: ["QtQuick/PointerTouchEvent 2.12"] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [12] } Component { name: "QQuickPositionerAttached" @@ -3815,8 +3959,8 @@ Module { Component { name: "QQuickPropertyAction" prototype: "QQuickAbstractAnimation" - exports: ["QtQuick/PropertyAction 2.0"] - exportMetaObjectRevisions: [0] + exports: ["QtQuick/PropertyAction 2.0", "QtQuick/PropertyAction 2.12"] + exportMetaObjectRevisions: [0, 12] Property { name: "target"; type: "QObject"; isPointer: true } Property { name: "property"; type: "string" } Property { name: "properties"; type: "string" } @@ -3835,8 +3979,11 @@ Module { Component { name: "QQuickPropertyAnimation" prototype: "QQuickAbstractAnimation" - exports: ["QtQuick/PropertyAnimation 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/PropertyAnimation 2.0", + "QtQuick/PropertyAnimation 2.12" + ] + exportMetaObjectRevisions: [0, 12] Property { name: "duration"; type: "int" } Property { name: "from"; type: "QVariant" } Property { name: "to"; type: "QVariant" } @@ -3872,8 +4019,14 @@ Module { name: "QQuickRectangle" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick/Rectangle 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/Rectangle 2.0", + "QtQuick/Rectangle 2.1", + "QtQuick/Rectangle 2.11", + "QtQuick/Rectangle 2.4", + "QtQuick/Rectangle 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Property { name: "color"; type: "QColor" } Property { name: "gradient"; type: "QJSValue" } Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true } @@ -3883,8 +4036,14 @@ Module { name: "QQuickRepeater" defaultProperty: "delegate" prototype: "QQuickItem" - exports: ["QtQuick/Repeater 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/Repeater 2.0", + "QtQuick/Repeater 2.1", + "QtQuick/Repeater 2.11", + "QtQuick/Repeater 2.4", + "QtQuick/Repeater 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Property { name: "model"; type: "QVariant" } Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } Property { name: "count"; type: "int"; isReadonly: true } @@ -3916,8 +4075,11 @@ Module { Component { name: "QQuickRotationAnimation" prototype: "QQuickPropertyAnimation" - exports: ["QtQuick/RotationAnimation 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/RotationAnimation 2.0", + "QtQuick/RotationAnimation 2.12" + ] + exportMetaObjectRevisions: [0, 12] Enum { name: "RotationDirection" values: { @@ -3934,8 +4096,11 @@ Module { Component { name: "QQuickRotationAnimator" prototype: "QQuickAnimator" - exports: ["QtQuick/RotationAnimator 2.2"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/RotationAnimator 2.12", + "QtQuick/RotationAnimator 2.2" + ] + exportMetaObjectRevisions: [12, 2] Enum { name: "RotationDirection" values: { @@ -3955,8 +4120,16 @@ Module { name: "QQuickRow" defaultProperty: "data" prototype: "QQuickBasePositioner" - exports: ["QtQuick/Row 2.0", "QtQuick/Row 2.6"] - exportMetaObjectRevisions: [0, 6] + exports: [ + "QtQuick/Row 2.0", + "QtQuick/Row 2.1", + "QtQuick/Row 2.11", + "QtQuick/Row 2.4", + "QtQuick/Row 2.6", + "QtQuick/Row 2.7", + "QtQuick/Row 2.9" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 6, 7, 9] Property { name: "layoutDirection"; type: "Qt::LayoutDirection" } Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } } @@ -3974,8 +4147,8 @@ Module { Component { name: "QQuickScaleAnimator" prototype: "QQuickAnimator" - exports: ["QtQuick/ScaleAnimator 2.2"] - exportMetaObjectRevisions: [0] + exports: ["QtQuick/ScaleAnimator 2.12", "QtQuick/ScaleAnimator 2.2"] + exportMetaObjectRevisions: [12, 2] } Component { name: "QQuickScaleGrid" @@ -3993,8 +4166,8 @@ Module { Component { name: "QQuickScriptAction" prototype: "QQuickAbstractAnimation" - exports: ["QtQuick/ScriptAction 2.0"] - exportMetaObjectRevisions: [0] + exports: ["QtQuick/ScriptAction 2.0", "QtQuick/ScriptAction 2.12"] + exportMetaObjectRevisions: [0, 12] Property { name: "script"; type: "QQmlScriptString" } Property { name: "scriptName"; type: "string" } } @@ -4002,15 +4175,24 @@ Module { name: "QQuickSequentialAnimation" defaultProperty: "animations" prototype: "QQuickAnimationGroup" - exports: ["QtQuick/SequentialAnimation 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/SequentialAnimation 2.0", + "QtQuick/SequentialAnimation 2.12" + ] + exportMetaObjectRevisions: [0, 12] } Component { name: "QQuickShaderEffect" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick/ShaderEffect 2.0", "QtQuick/ShaderEffect 2.4"] - exportMetaObjectRevisions: [0, 4] + exports: [ + "QtQuick/ShaderEffect 2.0", + "QtQuick/ShaderEffect 2.1", + "QtQuick/ShaderEffect 2.11", + "QtQuick/ShaderEffect 2.4", + "QtQuick/ShaderEffect 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Enum { name: "CullMode" values: { @@ -4050,10 +4232,14 @@ Module { prototype: "QQuickItem" exports: [ "QtQuick/ShaderEffectSource 2.0", + "QtQuick/ShaderEffectSource 2.1", + "QtQuick/ShaderEffectSource 2.11", + "QtQuick/ShaderEffectSource 2.4", "QtQuick/ShaderEffectSource 2.6", + "QtQuick/ShaderEffectSource 2.7", "QtQuick/ShaderEffectSource 2.9" ] - exportMetaObjectRevisions: [0, 6, 9] + exportMetaObjectRevisions: [0, 1, 11, 4, 6, 7, 9] Enum { name: "WrapMode" values: { @@ -4101,7 +4287,7 @@ Module { "QtQuick/Shortcut 2.6", "QtQuick/Shortcut 2.9" ] - exportMetaObjectRevisions: [0, 6, 9] + exportMetaObjectRevisions: [5, 6, 9] Property { name: "sequence"; type: "QVariant" } Property { name: "sequences"; revision: 9; type: "QVariantList" } Property { name: "nativeText"; revision: 6; type: "string"; isReadonly: true } @@ -4122,8 +4308,11 @@ Module { Component { name: "QQuickSmoothedAnimation" prototype: "QQuickNumberAnimation" - exports: ["QtQuick/SmoothedAnimation 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/SmoothedAnimation 2.0", + "QtQuick/SmoothedAnimation 2.12" + ] + exportMetaObjectRevisions: [0, 12] Enum { name: "ReversingMode" values: { @@ -4139,8 +4328,11 @@ Module { Component { name: "QQuickSpringAnimation" prototype: "QQuickNumberAnimation" - exports: ["QtQuick/SpringAnimation 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/SpringAnimation 2.0", + "QtQuick/SpringAnimation 2.12" + ] + exportMetaObjectRevisions: [0, 12] Property { name: "velocity"; type: "double" } Property { name: "spring"; type: "double" } Property { name: "damping"; type: "double" } @@ -4272,8 +4464,14 @@ Module { name: "QQuickSpriteSequence" defaultProperty: "sprites" prototype: "QQuickItem" - exports: ["QtQuick/SpriteSequence 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/SpriteSequence 2.0", + "QtQuick/SpriteSequence 2.1", + "QtQuick/SpriteSequence 2.11", + "QtQuick/SpriteSequence 2.4", + "QtQuick/SpriteSequence 2.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Property { name: "running"; type: "bool" } Property { name: "interpolate"; type: "bool" } Property { name: "goalSprite"; type: "string" } @@ -4431,7 +4629,7 @@ Module { defaultProperty: "flickableData" prototype: "QQuickFlickable" exports: ["QtQuick/TableView 2.12", "QtQuick/TableView 2.14"] - exportMetaObjectRevisions: [0, 14] + exportMetaObjectRevisions: [12, 14] attachedType: "QQuickTableViewAttached" Property { name: "rows"; type: "int"; isReadonly: true } Property { name: "columns"; type: "int"; isReadonly: true } @@ -4461,7 +4659,7 @@ Module { name: "QQuickTapHandler" prototype: "QQuickSinglePointHandler" exports: ["QtQuick/TapHandler 2.12"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [12] Enum { name: "GesturePolicy" values: { @@ -4495,14 +4693,17 @@ Module { prototype: "QQuickImplicitSizeItem" exports: [ "QtQuick/Text 2.0", + "QtQuick/Text 2.1", "QtQuick/Text 2.10", - "QtQuick/Text 2.12", + "QtQuick/Text 2.11", "QtQuick/Text 2.2", "QtQuick/Text 2.3", + "QtQuick/Text 2.4", "QtQuick/Text 2.6", + "QtQuick/Text 2.7", "QtQuick/Text 2.9" ] - exportMetaObjectRevisions: [0, 10, 12, 2, 3, 6, 9] + exportMetaObjectRevisions: [0, 1, 10, 11, 2, 3, 4, 6, 7, 9] Enum { name: "HAlignment" values: { @@ -4698,12 +4899,14 @@ Module { "QtQuick/TextEdit 2.0", "QtQuick/TextEdit 2.1", "QtQuick/TextEdit 2.10", + "QtQuick/TextEdit 2.11", "QtQuick/TextEdit 2.2", "QtQuick/TextEdit 2.3", + "QtQuick/TextEdit 2.4", "QtQuick/TextEdit 2.6", "QtQuick/TextEdit 2.7" ] - exportMetaObjectRevisions: [0, 1, 10, 2, 3, 6, 7] + exportMetaObjectRevisions: [0, 1, 10, 11, 2, 3, 4, 6, 7] Enum { name: "HAlignment" values: { @@ -4982,13 +5185,15 @@ Module { prototype: "QQuickImplicitSizeItem" exports: [ "QtQuick/TextInput 2.0", + "QtQuick/TextInput 2.1", + "QtQuick/TextInput 2.11", "QtQuick/TextInput 2.2", "QtQuick/TextInput 2.4", "QtQuick/TextInput 2.6", "QtQuick/TextInput 2.7", "QtQuick/TextInput 2.9" ] - exportMetaObjectRevisions: [0, 2, 4, 6, 7, 9] + exportMetaObjectRevisions: [0, 1, 11, 2, 4, 6, 7, 9] Enum { name: "EchoMode" values: { @@ -5238,7 +5443,7 @@ Module { name: "QQuickTextMetrics" prototype: "QObject" exports: ["QtQuick/TextMetrics 2.4"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [4] Property { name: "font"; type: "QFont" } Property { name: "text"; type: "string" } Property { name: "advanceWidth"; type: "double"; isReadonly: true } @@ -5255,7 +5460,7 @@ Module { name: "QQuickTouchPoint" prototype: "QObject" exports: ["QtQuick/TouchPoint 2.0", "QtQuick/TouchPoint 2.9"] - exportMetaObjectRevisions: [0, 0] + exportMetaObjectRevisions: [0, 9] Property { name: "pointId"; type: "int"; isReadonly: true } Property { name: "uniqueId"; revision: 9; type: "QPointingDeviceUniqueId"; isReadonly: true } Property { name: "pressed"; type: "bool"; isReadonly: true } @@ -5301,8 +5506,11 @@ Module { Component { name: "QQuickUniformAnimator" prototype: "QQuickAnimator" - exports: ["QtQuick/UniformAnimator 2.2"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/UniformAnimator 2.12", + "QtQuick/UniformAnimator 2.2" + ] + exportMetaObjectRevisions: [12, 2] Property { name: "uniform"; type: "string" } Signal { name: "uniformChanged" @@ -5312,8 +5520,11 @@ Module { Component { name: "QQuickVector3dAnimation" prototype: "QQuickPropertyAnimation" - exports: ["QtQuick/Vector3dAnimation 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick/Vector3dAnimation 2.0", + "QtQuick/Vector3dAnimation 2.12" + ] + exportMetaObjectRevisions: [0, 12] Property { name: "from"; type: "QVector3D" } Property { name: "to"; type: "QVector3D" } } @@ -5371,7 +5582,7 @@ Module { name: "QQuickWheelHandler" prototype: "QQuickSinglePointHandler" exports: ["QtQuick/WheelHandler 2.14"] - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [14] Property { name: "orientation"; type: "Qt::Orientation" } Property { name: "invertible"; type: "bool" } Property { name: "activeTimeout"; type: "double" } @@ -5403,14 +5614,14 @@ Module { Component { name: "QQuickXAnimator" prototype: "QQuickAnimator" - exports: ["QtQuick/XAnimator 2.2"] - exportMetaObjectRevisions: [0] + exports: ["QtQuick/XAnimator 2.12", "QtQuick/XAnimator 2.2"] + exportMetaObjectRevisions: [12, 2] } Component { name: "QQuickYAnimator" prototype: "QQuickAnimator" - exports: ["QtQuick/YAnimator 2.2"] - exportMetaObjectRevisions: [0] + exports: ["QtQuick/YAnimator 2.12", "QtQuick/YAnimator 2.2"] + exportMetaObjectRevisions: [12, 2] } Component { name: "QRegExpValidator" diff --git a/src/imports/settings/plugin.cpp b/src/imports/settings/plugin.cpp index eb7d5027a4..db941d9845 100644 --- a/src/imports/settings/plugin.cpp +++ b/src/imports/settings/plugin.cpp @@ -54,7 +54,7 @@ public: void registerTypes(const char *uri) override { Q_ASSERT(QByteArray(uri) == QByteArray("Qt.labs.settings")); - qmlRegisterType<QQmlSettings>(uri, 1, 0, "Settings"); + qmlRegisterTypesAndRevisions<QQmlSettings>(uri, 1); qmlRegisterModule(uri, 1, 1); // QTBUG-73239 } }; diff --git a/src/imports/settings/qqmlsettings_p.h b/src/imports/settings/qqmlsettings_p.h index a86c8b4751..3f1b83f541 100644 --- a/src/imports/settings/qqmlsettings_p.h +++ b/src/imports/settings/qqmlsettings_p.h @@ -66,6 +66,7 @@ class QQmlSettings : public QObject, public QQmlParserStatus Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(QString category READ category WRITE setCategory FINAL) Q_PROPERTY(QString fileName READ fileName WRITE setFileName FINAL) + QML_NAMED_ELEMENT(Settings) public: explicit QQmlSettings(QObject *parent = 0); diff --git a/src/imports/shapes/plugin.cpp b/src/imports/shapes/plugin.cpp index 0679a70630..80d197a544 100644 --- a/src/imports/shapes/plugin.cpp +++ b/src/imports/shapes/plugin.cpp @@ -57,21 +57,12 @@ public: void registerTypes(const char *uri) override { Q_ASSERT(QByteArray(uri) == QByteArray("QtQuick.Shapes")); - qmlRegisterType<QQuickShape>(uri, 1, 0, "Shape"); - qmlRegisterType<QQuickShapePath>(uri, 1, 0, "ShapePath"); - qmlRegisterUncreatableType<QQuickShapeGradient>(uri, 1, 0, "ShapeGradient", QQuickShapeGradient::tr("ShapeGradient is an abstract base class")); - qmlRegisterType<QQuickShapeLinearGradient>(uri, 1, 0, "LinearGradient"); - qmlRegisterType<QQuickShapeRadialGradient>(uri, 1, 0, "RadialGradient"); - qmlRegisterType<QQuickShapeConicalGradient>(uri, 1, 0, "ConicalGradient"); + qmlRegisterTypesAndRevisions<QQuickShape, QQuickShapePath, QQuickShapeGradient, + QQuickShapeLinearGradient, QQuickShapeRadialGradient, + QQuickShapeConicalGradient>(uri, 1); // Auto-increment the import to stay in sync with ALL future QtQuick minor versions qmlRegisterModule(uri, 1, QT_VERSION_MINOR); - - // revision in Qt 5.11: added containsMode property - qmlRegisterType<QQuickShape, 11>(uri, 1, 11, "Shape"); - - // revision in Qt 5.14: added scale property - qmlRegisterType<QQuickShapePath, 14>(uri, 1, 14, "ShapePath"); // QTBUG-61942 } }; diff --git a/src/imports/shapes/plugins.qmltypes b/src/imports/shapes/plugins.qmltypes index cd779e7149..fed68b5137 100644 --- a/src/imports/shapes/plugins.qmltypes +++ b/src/imports/shapes/plugins.qmltypes @@ -12,8 +12,14 @@ Module { name: "QQuickShape" defaultProperty: "data" prototype: "QQuickItem" - exports: ["QtQuick.Shapes/Shape 1.0", "QtQuick.Shapes/Shape 1.11"] - exportMetaObjectRevisions: [0, 11] + exports: [ + "QtQuick.Shapes/Shape 1.0", + "QtQuick.Shapes/Shape 1.1", + "QtQuick.Shapes/Shape 1.11", + "QtQuick.Shapes/Shape 1.4", + "QtQuick.Shapes/Shape 1.7" + ] + exportMetaObjectRevisions: [0, 1, 11, 4, 7] Enum { name: "RendererType" values: { @@ -51,8 +57,11 @@ Module { name: "QQuickShapeConicalGradient" defaultProperty: "stops" prototype: "QQuickShapeGradient" - exports: ["QtQuick.Shapes/ConicalGradient 1.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Shapes/ConicalGradient 1.0", + "QtQuick.Shapes/ConicalGradient 1.12" + ] + exportMetaObjectRevisions: [0, 12] Property { name: "centerX"; type: "double" } Property { name: "centerY"; type: "double" } Property { name: "angle"; type: "double" } @@ -61,9 +70,12 @@ Module { name: "QQuickShapeGradient" defaultProperty: "stops" prototype: "QQuickGradient" - exports: ["QtQuick.Shapes/ShapeGradient 1.0"] + exports: [ + "QtQuick.Shapes/ShapeGradient 1.0", + "QtQuick.Shapes/ShapeGradient 1.12" + ] isCreatable: false - exportMetaObjectRevisions: [0] + exportMetaObjectRevisions: [0, 12] Enum { name: "SpreadMode" values: { @@ -78,8 +90,11 @@ Module { name: "QQuickShapeLinearGradient" defaultProperty: "stops" prototype: "QQuickShapeGradient" - exports: ["QtQuick.Shapes/LinearGradient 1.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Shapes/LinearGradient 1.0", + "QtQuick.Shapes/LinearGradient 1.12" + ] + exportMetaObjectRevisions: [0, 12] Property { name: "x1"; type: "double" } Property { name: "y1"; type: "double" } Property { name: "x2"; type: "double" } @@ -142,8 +157,11 @@ Module { name: "QQuickShapeRadialGradient" defaultProperty: "stops" prototype: "QQuickShapeGradient" - exports: ["QtQuick.Shapes/RadialGradient 1.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Shapes/RadialGradient 1.0", + "QtQuick.Shapes/RadialGradient 1.12" + ] + exportMetaObjectRevisions: [0, 12] Property { name: "centerX"; type: "double" } Property { name: "centerY"; type: "double" } Property { name: "centerRadius"; type: "double" } diff --git a/src/imports/statemachine/finalstate.h b/src/imports/statemachine/finalstate.h index 974d8a8fac..9cdbb51584 100644 --- a/src/imports/statemachine/finalstate.h +++ b/src/imports/statemachine/finalstate.h @@ -45,6 +45,7 @@ #include <QtCore/QFinalState> #include <QtQml/QQmlListProperty> +#include <QtQml/qqml.h> QT_BEGIN_NAMESPACE @@ -54,6 +55,7 @@ class FinalState : public QFinalState Q_OBJECT Q_PROPERTY(QQmlListProperty<QObject> children READ children NOTIFY childrenChanged) Q_CLASSINFO("DefaultProperty", "children") + QML_ELEMENT public: explicit FinalState(QState *parent = 0); diff --git a/src/imports/statemachine/plugin.cpp b/src/imports/statemachine/plugin.cpp index bf7499b31a..c36e5097c6 100644 --- a/src/imports/statemachine/plugin.cpp +++ b/src/imports/statemachine/plugin.cpp @@ -42,6 +42,7 @@ #include "state.h" #include "statemachine.h" #include "timeouttransition.h" +#include "statemachineforeign.h" #include <QHistoryState> #include <QQmlExtensionPlugin> @@ -58,15 +59,10 @@ public: QtQmlStateMachinePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { } void registerTypes(const char *uri) override { - qmlRegisterType<State>(uri, 1, 0, "State"); - qmlRegisterType<StateMachine>(uri, 1, 0, "StateMachine"); - qmlRegisterType<QHistoryState>(uri, 1, 0, "HistoryState"); - qmlRegisterType<FinalState>(uri, 1, 0, "FinalState"); - qmlRegisterUncreatableType<QState>(uri, 1, 0, "QState", "Don't use this, use State instead"); - qmlRegisterUncreatableType<QAbstractState>(uri, 1, 0, "QAbstractState", "Don't use this, use State instead"); - qmlRegisterUncreatableType<QSignalTransition>(uri, 1, 0, "QSignalTransition", "Don't use this, use SignalTransition instead"); - qmlRegisterCustomType<SignalTransition>(uri, 1, 0, "SignalTransition", new SignalTransitionParser); - qmlRegisterType<TimeoutTransition>(uri, 1, 0, "TimeoutTransition"); + qmlRegisterTypesAndRevisions< + State, StateMachine, FinalState, TimeoutTransition, SignalTransition, + QHistoryStateForeign, QStateForeign, QAbstractStateForeign, QSignalTransitionForeign + >(uri, 1); qmlProtectModule(uri, 1); // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward diff --git a/src/imports/statemachine/plugins.qmltypes b/src/imports/statemachine/plugins.qmltypes index 541b1cc114..206159f057 100644 --- a/src/imports/statemachine/plugins.qmltypes +++ b/src/imports/statemachine/plugins.qmltypes @@ -137,8 +137,11 @@ Module { Component { name: "SignalTransition" prototype: "QSignalTransition" - exports: ["QtQml.StateMachine/SignalTransition 1.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQml.StateMachine/SignalTransition 1.0", + "QtQml.StateMachine/SignalTransition 1.1" + ] + exportMetaObjectRevisions: [0, 1] Property { name: "signal"; type: "QJSValue" } Property { name: "guard"; type: "QQmlScriptString" } Signal { name: "invokeYourself" } @@ -166,8 +169,11 @@ Module { Component { name: "TimeoutTransition" prototype: "QSignalTransition" - exports: ["QtQml.StateMachine/TimeoutTransition 1.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQml.StateMachine/TimeoutTransition 1.0", + "QtQml.StateMachine/TimeoutTransition 1.1" + ] + exportMetaObjectRevisions: [0, 1] Property { name: "timeout"; type: "int" } } } diff --git a/src/imports/statemachine/signaltransition.h b/src/imports/statemachine/signaltransition.h index f005c5e9b1..748e230b3e 100644 --- a/src/imports/statemachine/signaltransition.h +++ b/src/imports/statemachine/signaltransition.h @@ -57,6 +57,7 @@ class SignalTransition : public QSignalTransition, public QQmlParserStatus Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(QJSValue signal READ signal WRITE setSignal NOTIFY qmlSignalChanged) Q_PROPERTY(QQmlScriptString guard READ guard WRITE setGuard NOTIFY guardChanged) + QML_ELEMENT public: explicit SignalTransition(QState *parent = nullptr); @@ -101,6 +102,12 @@ public: void applyBindings(QObject *object, const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) override; }; +template<> +inline QQmlCustomParser *qmlCreateCustomParser<SignalTransition>() +{ + return new SignalTransitionParser; +} + QT_END_NAMESPACE #endif diff --git a/src/imports/statemachine/state.h b/src/imports/statemachine/state.h index 8e8cefab19..4b17ea0e5f 100644 --- a/src/imports/statemachine/state.h +++ b/src/imports/statemachine/state.h @@ -45,6 +45,7 @@ #include <QtCore/QState> #include <QtQml/QQmlParserStatus> #include <QtQml/QQmlListProperty> +#include <QtQml/qqml.h> QT_BEGIN_NAMESPACE @@ -54,6 +55,7 @@ class State : public QState, public QQmlParserStatus Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(QQmlListProperty<QObject> children READ children NOTIFY childrenChanged) Q_CLASSINFO("DefaultProperty", "children") + QML_ELEMENT public: explicit State(QState *parent = 0); diff --git a/src/imports/statemachine/statemachine.h b/src/imports/statemachine/statemachine.h index 1fa7a9da43..04894477b3 100644 --- a/src/imports/statemachine/statemachine.h +++ b/src/imports/statemachine/statemachine.h @@ -45,6 +45,7 @@ #include <QtCore/QStateMachine> #include <QtQml/QQmlParserStatus> #include <QtQml/QQmlListProperty> +#include <QtQml/qqml.h> QT_BEGIN_NAMESPACE @@ -58,6 +59,7 @@ class StateMachine : public QStateMachine, public QQmlParserStatus Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY qmlRunningChanged) Q_CLASSINFO("DefaultProperty", "children") + QML_ELEMENT public: explicit StateMachine(QObject *parent = 0); diff --git a/src/imports/statemachine/statemachine.pro b/src/imports/statemachine/statemachine.pro index 926a9d4a5e..7affc768e2 100644 --- a/src/imports/statemachine/statemachine.pro +++ b/src/imports/statemachine/statemachine.pro @@ -19,6 +19,7 @@ HEADERS = \ $$PWD/signaltransition.h \ $$PWD/state.h \ $$PWD/statemachine.h \ - $$PWD/timeouttransition.h + $$PWD/timeouttransition.h \ + $$PWD/statemachineforeign.h load(qml_plugin) diff --git a/src/imports/statemachine/statemachineforeign.h b/src/imports/statemachine/statemachineforeign.h new file mode 100644 index 0000000000..363c9d0e31 --- /dev/null +++ b/src/imports/statemachine/statemachineforeign.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef STATEMACHINEFOREIGN_H +#define STATEMACHINEFOREIGN_H + +#include <QtQml/qqml.h> +#include <QtCore/qhistorystate.h> +#include <QtCore/qstate.h> +#include <QtCore/qabstractstate.h> +#include <QtCore/qsignaltransition.h> + +struct QHistoryStateForeign +{ + Q_GADGET + QML_FOREIGN(QHistoryState) + QML_NAMED_ELEMENT(HistoryState) +}; + +struct QStateForeign +{ + Q_GADGET + QML_FOREIGN(QState) + QML_NAMED_ELEMENT(QState) + QML_UNCREATABLE("Don't use this, use State instead.") +}; + +struct QAbstractStateForeign +{ + Q_GADGET + QML_FOREIGN(QAbstractState) + QML_NAMED_ELEMENT(QAbstractState) + QML_UNCREATABLE("Don't use this, use State instead.") +}; + +struct QSignalTransitionForeign +{ + Q_GADGET + QML_FOREIGN(QSignalTransition) + QML_NAMED_ELEMENT(QSignalTransition) + QML_UNCREATABLE("Don't use this, use SignalTransition instead.") +}; + +#endif // STATEMACHINEFOREIGN_H diff --git a/src/imports/statemachine/timeouttransition.h b/src/imports/statemachine/timeouttransition.h index 2fc850fc70..cc3a22e0e5 100644 --- a/src/imports/statemachine/timeouttransition.h +++ b/src/imports/statemachine/timeouttransition.h @@ -42,6 +42,7 @@ #include <QtCore/QSignalTransition> #include <QtQml/QQmlParserStatus> +#include <QtQml/qqml.h> QT_BEGIN_NAMESPACE class QTimer; @@ -51,6 +52,7 @@ class TimeoutTransition : public QSignalTransition, public QQmlParserStatus Q_OBJECT Q_PROPERTY(int timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged) Q_INTERFACES(QQmlParserStatus) + QML_ELEMENT public: TimeoutTransition(QState *parent = nullptr); diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp index c52cf417a6..bf6b550f47 100644 --- a/src/imports/testlib/main.cpp +++ b/src/imports/testlib/main.cpp @@ -62,6 +62,7 @@ class QuickTestUtil : public QObject Q_OBJECT Q_PROPERTY(bool printAvailableFunctions READ printAvailableFunctions NOTIFY printAvailableFunctionsChanged) Q_PROPERTY(int dragThreshold READ dragThreshold NOTIFY dragThresholdChanged) + QML_NAMED_ELEMENT(TestUtil) public: QuickTestUtil(QObject *parent = nullptr) :QObject(parent) @@ -144,13 +145,8 @@ public: void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtTest")); - qmlRegisterType<QuickTestResult, 0>(uri,1,0,"TestResult"); - qmlRegisterType<QuickTestResult, 1>(uri,1,1,"TestResult"); - qmlRegisterType<QuickTestResult, 13>(uri,1,13,"TestResult"); - qmlRegisterType<QuickTestEvent>(uri,1,0,"TestEvent"); - qmlRegisterType<QuickTestEvent>(uri,1,2,"TestEvent"); - qmlRegisterType<QuickTestUtil>(uri,1,0,"TestUtil"); - qmlRegisterAnonymousType<QQuickTouchEventSequence>(uri, 1); + qmlRegisterTypesAndRevisions<QuickTestResult, QuickTestEvent, + QuickTestUtil, QQuickTouchEventSequence>(uri, 1); // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward qmlRegisterModule(uri, 1, QT_VERSION_MINOR); diff --git a/src/imports/testlib/plugins.qmltypes b/src/imports/testlib/plugins.qmltypes index 6a1371e5f1..0491079e86 100644 --- a/src/imports/testlib/plugins.qmltypes +++ b/src/imports/testlib/plugins.qmltypes @@ -46,7 +46,7 @@ Module { name: "QuickTestEvent" prototype: "QObject" exports: ["QtTest/TestEvent 1.0", "QtTest/TestEvent 1.2"] - exportMetaObjectRevisions: [0, 0] + exportMetaObjectRevisions: [0, 2] Property { name: "defaultMouseDelay"; type: "int"; isReadonly: true } Method { name: "keyPress" diff --git a/src/imports/wavefrontmesh/plugin.cpp b/src/imports/wavefrontmesh/plugin.cpp index 1a266b7e36..6a1cd91670 100644 --- a/src/imports/wavefrontmesh/plugin.cpp +++ b/src/imports/wavefrontmesh/plugin.cpp @@ -57,7 +57,7 @@ public: void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.wavefrontmesh")); - qmlRegisterType<QWavefrontMesh>(uri, 1, 0, "WavefrontMesh"); + qmlRegisterTypesAndRevisions<QWavefrontMesh>(uri, 1); // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.12 onward qmlRegisterModule(uri, 1, QT_VERSION_MINOR); diff --git a/src/imports/wavefrontmesh/qwavefrontmesh.h b/src/imports/wavefrontmesh/qwavefrontmesh.h index e3ded8078e..a8a40c1a6a 100644 --- a/src/imports/wavefrontmesh/qwavefrontmesh.h +++ b/src/imports/wavefrontmesh/qwavefrontmesh.h @@ -55,6 +55,8 @@ class QWavefrontMesh : public QQuickShaderEffectMesh Q_PROPERTY(Error lastError READ lastError NOTIFY lastErrorChanged) Q_PROPERTY(QVector3D projectionPlaneV READ projectionPlaneV WRITE setProjectionPlaneV NOTIFY projectionPlaneVChanged) Q_PROPERTY(QVector3D projectionPlaneW READ projectionPlaneW WRITE setProjectionPlaneW NOTIFY projectionPlaneWChanged) + QML_NAMED_ELEMENT(WavefrontMesh) + public: enum Error { NoError, diff --git a/src/imports/window/plugins.qmltypes b/src/imports/window/plugins.qmltypes index 82b7ce0fc5..d9a9b432a2 100644 --- a/src/imports/window/plugins.qmltypes +++ b/src/imports/window/plugins.qmltypes @@ -24,9 +24,13 @@ Module { Component { name: "QQuickScreen" prototype: "QObject" - exports: ["QtQuick.Window/Screen 2.0", "QtQuick.Window/Screen 2.3"] + exports: [ + "QtQuick.Window/Screen 2.0", + "QtQuick.Window/Screen 2.10", + "QtQuick.Window/Screen 2.3" + ] isCreatable: false - exportMetaObjectRevisions: [0, 3] + exportMetaObjectRevisions: [0, 10, 3] attachedType: "QQuickScreenAttached" } Component { @@ -163,10 +167,11 @@ Module { exports: [ "QtQuick.Window/Window 2.1", "QtQuick.Window/Window 2.13", + "QtQuick.Window/Window 2.14", "QtQuick.Window/Window 2.2", "QtQuick.Window/Window 2.3" ] - exportMetaObjectRevisions: [0, 13, 2, 3] + exportMetaObjectRevisions: [1, 13, 14, 2, 3] attachedType: "QQuickWindowAttached" Property { name: "visible"; type: "bool" } Property { name: "visibility"; type: "Visibility" } diff --git a/src/particles/qquickage_p.h b/src/particles/qquickage_p.h index 5db6167dc1..890c6a63c1 100644 --- a/src/particles/qquickage_p.h +++ b/src/particles/qquickage_p.h @@ -59,6 +59,7 @@ class QQuickAgeAffector : public QQuickParticleAffector Q_OBJECT Q_PROPERTY(int lifeLeft READ lifeLeft WRITE setLifeLeft NOTIFY lifeLeftChanged) Q_PROPERTY(bool advancePosition READ advancePosition WRITE setAdvancePosition NOTIFY advancePositionChanged) + QML_NAMED_ELEMENT(Age) public: explicit QQuickAgeAffector(QQuickItem *parent = 0); diff --git a/src/particles/qquickangledirection_p.h b/src/particles/qquickangledirection_p.h index 66290fb19e..d0fdf5a68c 100644 --- a/src/particles/qquickangledirection_p.h +++ b/src/particles/qquickangledirection_p.h @@ -51,6 +51,8 @@ // We mean it. // #include "qquickdirection_p.h" +#include <QtQml/qqml.h> + QT_BEGIN_NAMESPACE class QQuickAngleDirection : public QQuickDirection @@ -60,6 +62,7 @@ class QQuickAngleDirection : public QQuickDirection Q_PROPERTY(qreal magnitude READ magnitude WRITE setMagnitude NOTIFY magnitudeChanged) Q_PROPERTY(qreal angleVariation READ angleVariation WRITE setAngleVariation NOTIFY angleVariationChanged) Q_PROPERTY(qreal magnitudeVariation READ magnitudeVariation WRITE setMagnitudeVariation NOTIFY magnitudeVariationChanged) + QML_NAMED_ELEMENT(AngleDirection) public: explicit QQuickAngleDirection(QObject *parent = 0); QPointF sample(const QPointF &from) override; diff --git a/src/particles/qquickcumulativedirection_p.h b/src/particles/qquickcumulativedirection_p.h index 39f8ab8a24..5160d8f09a 100644 --- a/src/particles/qquickcumulativedirection_p.h +++ b/src/particles/qquickcumulativedirection_p.h @@ -52,6 +52,8 @@ // #include "qquickdirection_p.h" #include <QQmlListProperty> +#include <QtQml/qqml.h> + QT_BEGIN_NAMESPACE class QQuickCumulativeDirection : public QQuickDirection @@ -59,6 +61,7 @@ class QQuickCumulativeDirection : public QQuickDirection Q_OBJECT Q_PROPERTY(QQmlListProperty<QQuickDirection> directions READ directions) Q_CLASSINFO("DefaultProperty", "directions") + QML_NAMED_ELEMENT(CumulativeDirection) public: explicit QQuickCumulativeDirection(QObject *parent = 0); QQmlListProperty<QQuickDirection> directions(); diff --git a/src/particles/qquickcustomaffector_p.h b/src/particles/qquickcustomaffector_p.h index 10db70d71d..9fb7e67521 100644 --- a/src/particles/qquickcustomaffector_p.h +++ b/src/particles/qquickcustomaffector_p.h @@ -52,6 +52,7 @@ // #include <QObject> +#include <QtQml/qqml.h> #include "qquickparticlesystem_p.h" #include "qquickparticleextruder_p.h" #include "qquickparticleaffector_p.h" @@ -66,6 +67,7 @@ class QQuickCustomAffector : public QQuickParticleAffector Q_PROPERTY(QQuickDirection *position READ position WRITE setPosition NOTIFY positionChanged RESET positionReset) Q_PROPERTY(QQuickDirection *velocity READ velocity WRITE setVelocity NOTIFY velocityChanged RESET velocityReset) Q_PROPERTY(QQuickDirection *acceleration READ acceleration WRITE setAcceleration NOTIFY accelerationChanged RESET accelerationReset) + QML_NAMED_ELEMENT(Affector) public: explicit QQuickCustomAffector(QQuickItem *parent = 0); diff --git a/src/particles/qquickcustomparticle_p.h b/src/particles/qquickcustomparticle_p.h index e2292cb33b..444f7ad215 100644 --- a/src/particles/qquickcustomparticle_p.h +++ b/src/particles/qquickcustomparticle_p.h @@ -67,6 +67,7 @@ class QQuickCustomParticle : public QQuickParticlePainter Q_OBJECT Q_PROPERTY(QByteArray fragmentShader READ fragmentShader WRITE setFragmentShader NOTIFY fragmentShaderChanged) Q_PROPERTY(QByteArray vertexShader READ vertexShader WRITE setVertexShader NOTIFY vertexShaderChanged) + QML_NAMED_ELEMENT(CustomParticle) public: explicit QQuickCustomParticle(QQuickItem* parent=0); diff --git a/src/particles/qquickdirection_p.h b/src/particles/qquickdirection_p.h index 10960f9920..60b4d8eb1d 100644 --- a/src/particles/qquickdirection_p.h +++ b/src/particles/qquickdirection_p.h @@ -53,12 +53,16 @@ #include <QObject> #include <QPointF> +#include <QtQml/qqml.h> QT_BEGIN_NAMESPACE class QQuickDirection : public QObject { Q_OBJECT + QML_NAMED_ELEMENT(NullVector) + QML_UNCREATABLE("Abstract type. Use one of the inheriting types instead.") + public: explicit QQuickDirection(QObject *parent = 0); diff --git a/src/particles/qquickellipseextruder_p.h b/src/particles/qquickellipseextruder_p.h index 0af7f4d94f..c92443fedf 100644 --- a/src/particles/qquickellipseextruder_p.h +++ b/src/particles/qquickellipseextruder_p.h @@ -58,6 +58,7 @@ class QQuickEllipseExtruder : public QQuickParticleExtruder { Q_OBJECT Q_PROPERTY(bool fill READ fill WRITE setFill NOTIFY fillChanged)//###Use base class? If it's still box + QML_NAMED_ELEMENT(EllipseShape) public: explicit QQuickEllipseExtruder(QObject *parent = 0); QPointF extrude(const QRectF &) override; diff --git a/src/particles/qquickfriction_p.h b/src/particles/qquickfriction_p.h index 05ae7a38d5..5686bb37d5 100644 --- a/src/particles/qquickfriction_p.h +++ b/src/particles/qquickfriction_p.h @@ -59,6 +59,7 @@ class QQuickFrictionAffector : public QQuickParticleAffector Q_OBJECT Q_PROPERTY(qreal factor READ factor WRITE setFactor NOTIFY factorChanged) Q_PROPERTY(qreal threshold READ threshold WRITE setThreshold NOTIFY thresholdChanged) + QML_NAMED_ELEMENT(Friction) public: explicit QQuickFrictionAffector(QQuickItem *parent = 0); diff --git a/src/particles/qquickgravity_p.h b/src/particles/qquickgravity_p.h index 333d3d1534..ef7cc770b7 100644 --- a/src/particles/qquickgravity_p.h +++ b/src/particles/qquickgravity_p.h @@ -51,6 +51,7 @@ // We mean it. // #include "qquickparticleaffector_p.h" +#include <QtQml/qqml.h> QT_BEGIN_NAMESPACE @@ -60,6 +61,7 @@ class QQuickGravityAffector : public QQuickParticleAffector Q_PROPERTY(qreal magnitude READ magnitude WRITE setMagnitude NOTIFY magnitudeChanged) Q_PROPERTY(qreal acceleration READ magnitude WRITE setAcceleration NOTIFY magnitudeChanged) Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged) + QML_NAMED_ELEMENT(Gravity) public: explicit QQuickGravityAffector(QQuickItem *parent = 0); qreal magnitude() const; diff --git a/src/particles/qquickgroupgoal_p.h b/src/particles/qquickgroupgoal_p.h index 9a56ef5cce..022b244ed7 100644 --- a/src/particles/qquickgroupgoal_p.h +++ b/src/particles/qquickgroupgoal_p.h @@ -61,6 +61,7 @@ class QQuickGroupGoalAffector : public QQuickParticleAffector Q_OBJECT Q_PROPERTY(QString goalState READ goalState WRITE setGoalState NOTIFY goalStateChanged) Q_PROPERTY(bool jump READ jump WRITE setJump NOTIFY jumpChanged) + QML_NAMED_ELEMENT(GroupGoal) public: explicit QQuickGroupGoalAffector(QQuickItem *parent = 0); diff --git a/src/particles/qquickimageparticle_p.h b/src/particles/qquickimageparticle_p.h index 059cf67019..83fc75e9c9 100644 --- a/src/particles/qquickimageparticle_p.h +++ b/src/particles/qquickimageparticle_p.h @@ -202,6 +202,7 @@ class QQuickImageParticle : public QQuickParticlePainter Q_PROPERTY(bool spritesInterpolate READ spritesInterpolate WRITE setSpritesInterpolate NOTIFY spritesInterpolateChanged) Q_PROPERTY(EntryEffect entryEffect READ entryEffect WRITE setEntryEffect NOTIFY entryEffectChanged) + QML_NAMED_ELEMENT(ImageParticle) public: explicit QQuickImageParticle(QQuickItem *parent = 0); virtual ~QQuickImageParticle(); diff --git a/src/particles/qquickitemparticle_p.h b/src/particles/qquickitemparticle_p.h index 7867add4e4..70cfe2a446 100644 --- a/src/particles/qquickitemparticle_p.h +++ b/src/particles/qquickitemparticle_p.h @@ -63,6 +63,8 @@ class QQuickItemParticle : public QQuickParticlePainter Q_OBJECT Q_PROPERTY(bool fade READ fade WRITE setFade NOTIFY fadeChanged) Q_PROPERTY(QQmlComponent* delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) + QML_NAMED_ELEMENT(ItemParticle) + QML_ATTACHED(QQuickItemParticleAttached) public: explicit QQuickItemParticle(QQuickItem *parent = 0); ~QQuickItemParticle(); @@ -143,6 +145,4 @@ Q_SIGNALS: QT_END_NAMESPACE -QML_DECLARE_TYPEINFO(QQuickItemParticle, QML_HAS_ATTACHED_PROPERTIES) - #endif // ITEMPARTICLE_H diff --git a/src/particles/qquicklineextruder_p.h b/src/particles/qquicklineextruder_p.h index 306f3a1dd6..76ac5aaf11 100644 --- a/src/particles/qquicklineextruder_p.h +++ b/src/particles/qquicklineextruder_p.h @@ -57,6 +57,7 @@ class QQuickLineExtruder : public QQuickParticleExtruder Q_OBJECT //Default is topleft to bottom right. Flipped makes it topright to bottom left Q_PROPERTY(bool mirrored READ mirrored WRITE setMirrored NOTIFY mirroredChanged) + QML_NAMED_ELEMENT(LineShape) public: explicit QQuickLineExtruder(QObject *parent = 0); diff --git a/src/particles/qquickmaskextruder_p.h b/src/particles/qquickmaskextruder_p.h index 0fc0331db8..62c8c3f04b 100644 --- a/src/particles/qquickmaskextruder_p.h +++ b/src/particles/qquickmaskextruder_p.h @@ -61,6 +61,7 @@ class QQuickMaskExtruder : public QQuickParticleExtruder { Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) + QML_NAMED_ELEMENT(MaskShape) public: explicit QQuickMaskExtruder(QObject *parent = 0); QPointF extrude(const QRectF &) override; diff --git a/src/particles/qquickparticleaffector_p.h b/src/particles/qquickparticleaffector_p.h index 5c9652bc32..fd4887333e 100644 --- a/src/particles/qquickparticleaffector_p.h +++ b/src/particles/qquickparticleaffector_p.h @@ -68,6 +68,9 @@ class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleAffector : public QQuickItem Q_PROPERTY(bool once READ onceOff WRITE setOnceOff NOTIFY onceChanged) Q_PROPERTY(QQuickParticleExtruder* shape READ shape WRITE setShape NOTIFY shapeChanged) + QML_NAMED_ELEMENT(ParticleAffector) + QML_UNCREATABLE("Abstract type. Use one of the inheriting types instead.") + public: explicit QQuickParticleAffector(QQuickItem *parent = 0); virtual void affectSystem(qreal dt); diff --git a/src/particles/qquickparticleemitter_p.h b/src/particles/qquickparticleemitter_p.h index 64b9bcef32..b97d3f812a 100644 --- a/src/particles/qquickparticleemitter_p.h +++ b/src/particles/qquickparticleemitter_p.h @@ -83,6 +83,7 @@ class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleEmitter : public QQuickItem Q_PROPERTY(QQuickDirection *velocity READ velocity WRITE setVelocity NOTIFY velocityChanged) Q_PROPERTY(QQuickDirection *acceleration READ acceleration WRITE setAcceleration NOTIFY accelerationChanged) Q_PROPERTY(qreal velocityFromMovement READ velocityFromMovement WRITE setVelocityFromMovement NOTIFY velocityFromMovementChanged) + QML_NAMED_ELEMENT(Emitter) public: explicit QQuickParticleEmitter(QQuickItem *parent = 0); diff --git a/src/particles/qquickparticleextruder_p.h b/src/particles/qquickparticleextruder_p.h index 38b2e34c77..24f7a0a2fa 100644 --- a/src/particles/qquickparticleextruder_p.h +++ b/src/particles/qquickparticleextruder_p.h @@ -54,6 +54,7 @@ #include <QObject> #include <QRectF> #include <QPointF> +#include <QtQml/qqml.h> QT_BEGIN_NAMESPACE @@ -61,6 +62,9 @@ class QQuickParticleExtruder : public QObject { Q_OBJECT + QML_NAMED_ELEMENT(ParticleExtruder) + QML_UNCREATABLE("Abstract type. Use one of the inheriting types instead.") + public: explicit QQuickParticleExtruder(QObject *parent = 0); virtual QPointF extrude(const QRectF &); diff --git a/src/particles/qquickparticlegroup_p.h b/src/particles/qquickparticlegroup_p.h index 0314234569..8d068fbe9c 100644 --- a/src/particles/qquickparticlegroup_p.h +++ b/src/particles/qquickparticlegroup_p.h @@ -66,6 +66,7 @@ class QQuickParticleGroup : public QQuickStochasticState, public QQmlParserStatu //Intercept children requests and assign to the group & system Q_PROPERTY(QQmlListProperty<QObject> particleChildren READ particleChildren DESIGNABLE false)//### Hidden property for in-state system definitions - ought not to be used in actual "Sprite" states Q_CLASSINFO("DefaultProperty", "particleChildren") + QML_NAMED_ELEMENT(ParticleGroup) Q_INTERFACES(QQmlParserStatus) public: diff --git a/src/particles/qquickparticlepainter_p.h b/src/particles/qquickparticlepainter_p.h index 16fc6b6f45..e3d13b8a21 100644 --- a/src/particles/qquickparticlepainter_p.h +++ b/src/particles/qquickparticlepainter_p.h @@ -64,6 +64,9 @@ class QQuickParticlePainter : public QQuickItem Q_PROPERTY(QQuickParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged) Q_PROPERTY(QStringList groups READ groups WRITE setGroups NOTIFY groupsChanged) + QML_NAMED_ELEMENT(ParticlePainter) + QML_UNCREATABLE("Abstract type. Use one of the inheriting types instead.") + public: // data typedef QQuickParticleVarLengthArray<QQuickParticleGroupData::ID, 4> GroupIDs; diff --git a/src/particles/qquickparticlesmodule.cpp b/src/particles/qquickparticlesmodule.cpp index 03f47a3961..4f2e1cf29d 100644 --- a/src/particles/qquickparticlesmodule.cpp +++ b/src/particles/qquickparticlesmodule.cpp @@ -84,47 +84,45 @@ void QQuickParticlesModule::defineModule() const char* uri = "QtQuick.Particles"; - qmlRegisterType<QQuickParticleSystem>(uri, 2, 0, "ParticleSystem"); - qmlRegisterType<QQuickParticleGroup>(uri, 2, 0, "ParticleGroup"); + qmlRegisterTypesAndRevisions< + QQuickParticleSystem, + QQuickParticleGroup, - qmlRegisterType<QQuickImageParticle>(uri, 2, 0, "ImageParticle"); + QQuickImageParticle, #if QT_CONFIG(quick_shadereffect) - qmlRegisterType<QQuickCustomParticle>(uri, 2, 0, "CustomParticle"); + QQuickCustomParticle, #endif - qmlRegisterType<QQuickItemParticle>(uri, 2, 0, "ItemParticle"); + QQuickItemParticle, - qmlRegisterType<QQuickParticleEmitter>(uri, 2, 0, "Emitter"); - qmlRegisterType<QQuickTrailEmitter>(uri, 2, 0, "TrailEmitter"); + QQuickParticleEmitter, + QQuickTrailEmitter, - qmlRegisterType<QQuickEllipseExtruder>(uri, 2, 0, "EllipseShape"); - qmlRegisterType<QQuickRectangleExtruder>(uri, 2, 0, "RectangleShape"); - qmlRegisterType<QQuickLineExtruder>(uri, 2, 0, "LineShape"); - qmlRegisterType<QQuickMaskExtruder>(uri, 2, 0, "MaskShape"); + QQuickEllipseExtruder, + QQuickRectangleExtruder, + QQuickLineExtruder, + QQuickMaskExtruder, - qmlRegisterType<QQuickPointDirection>(uri, 2, 0, "PointDirection"); - qmlRegisterType<QQuickAngleDirection>(uri, 2, 0, "AngleDirection"); - qmlRegisterType<QQuickTargetDirection>(uri, 2, 0, "TargetDirection"); - qmlRegisterType<QQuickCumulativeDirection>(uri, 2, 0, "CumulativeDirection"); + QQuickPointDirection, + QQuickAngleDirection, + QQuickTargetDirection, + QQuickCumulativeDirection, - qmlRegisterType<QQuickCustomAffector>(uri, 2, 0, "Affector"); - qmlRegisterType<QQuickWanderAffector>(uri, 2, 0, "Wander"); - qmlRegisterType<QQuickFrictionAffector>(uri, 2, 0, "Friction"); - qmlRegisterType<QQuickAttractorAffector>(uri, 2, 0, "Attractor"); - qmlRegisterType<QQuickGravityAffector>(uri, 2, 0, "Gravity"); - qmlRegisterType<QQuickAgeAffector>(uri, 2, 0, "Age"); - qmlRegisterType<QQuickSpriteGoalAffector>(uri, 2, 0, "SpriteGoal"); - qmlRegisterType<QQuickGroupGoalAffector>(uri, 2, 0, "GroupGoal"); - qmlRegisterType<QQuickTurbulenceAffector>(uri, 2, 0 , "Turbulence"); + QQuickCustomAffector, + QQuickWanderAffector, + QQuickFrictionAffector, + QQuickAttractorAffector, + QQuickGravityAffector, + QQuickAgeAffector, + QQuickSpriteGoalAffector, + QQuickGroupGoalAffector, + QQuickTurbulenceAffector, - //Exposed just for completeness - qmlRegisterUncreatableType<QQuickParticleAffector>(uri, 2, 0, "ParticleAffector", - QStringLiteral("Abstract type. Use one of the inheriting types instead.")); - qmlRegisterUncreatableType<QQuickParticlePainter>(uri, 2, 0, "ParticlePainter", - QStringLiteral("Abstract type. Use one of the inheriting types instead.")); - qmlRegisterUncreatableType<QQuickParticleExtruder>(uri, 2, 0, "ParticleExtruder", - QStringLiteral("Abstract type. Use one of the inheriting types instead.")); - qmlRegisterUncreatableType<QQuickDirection>(uri, 2, 0, "NullVector", - QStringLiteral("Abstract type. Use one of the inheriting types instead.")); + // Exposed just for completeness + QQuickParticleAffector, + QQuickParticlePainter, + QQuickParticleExtruder, + QQuickDirection + >(uri, 2); } QT_END_NAMESPACE diff --git a/src/particles/qquickparticlesystem_p.h b/src/particles/qquickparticlesystem_p.h index 1e34086b0c..dd721a7164 100644 --- a/src/particles/qquickparticlesystem_p.h +++ b/src/particles/qquickparticlesystem_p.h @@ -349,6 +349,7 @@ class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleSystem : public QQuickItem Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged) Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) Q_PROPERTY(bool empty READ isEmpty NOTIFY emptyChanged) + QML_NAMED_ELEMENT(ParticleSystem) public: explicit QQuickParticleSystem(QQuickItem *parent = nullptr); diff --git a/src/particles/qquickpointattractor_p.h b/src/particles/qquickpointattractor_p.h index 47985b5e82..28bbaaa84f 100644 --- a/src/particles/qquickpointattractor_p.h +++ b/src/particles/qquickpointattractor_p.h @@ -62,6 +62,7 @@ class QQuickAttractorAffector : public QQuickParticleAffector Q_PROPERTY(qreal pointY READ pointY WRITE setPointY NOTIFY pointYChanged) Q_PROPERTY(AffectableParameters affectedParameter READ affectedParameter WRITE setAffectedParameter NOTIFY affectedParameterChanged) Q_PROPERTY(Proportion proportionalToDistance READ proportionalToDistance WRITE setProportionalToDistance NOTIFY proportionalToDistanceChanged) + QML_NAMED_ELEMENT(Attractor) public: enum Proportion{ diff --git a/src/particles/qquickpointdirection_p.h b/src/particles/qquickpointdirection_p.h index a80be928ad..9103a570c9 100644 --- a/src/particles/qquickpointdirection_p.h +++ b/src/particles/qquickpointdirection_p.h @@ -61,6 +61,7 @@ class QQuickPointDirection : public QQuickDirection Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged) Q_PROPERTY(qreal xVariation READ xVariation WRITE setXVariation NOTIFY xVariationChanged) Q_PROPERTY(qreal yVariation READ yVariation WRITE setYVariation NOTIFY yVariationChanged) + QML_NAMED_ELEMENT(PointDirection) public: explicit QQuickPointDirection(QObject *parent = 0); QPointF sample(const QPointF &from) override; diff --git a/src/particles/qquickrectangleextruder_p.h b/src/particles/qquickrectangleextruder_p.h index 630cf3050d..7c0a6c2bf1 100644 --- a/src/particles/qquickrectangleextruder_p.h +++ b/src/particles/qquickrectangleextruder_p.h @@ -59,6 +59,7 @@ class QQuickRectangleExtruder : public QQuickParticleExtruder { Q_OBJECT Q_PROPERTY(bool fill READ fill WRITE setFill NOTIFY fillChanged) + QML_NAMED_ELEMENT(RectangleShape) public: explicit QQuickRectangleExtruder(QObject *parent = 0); diff --git a/src/particles/qquickspritegoal_p.h b/src/particles/qquickspritegoal_p.h index e569603550..d5f9bb88ae 100644 --- a/src/particles/qquickspritegoal_p.h +++ b/src/particles/qquickspritegoal_p.h @@ -63,6 +63,7 @@ class QQuickSpriteGoalAffector : public QQuickParticleAffector Q_PROPERTY(QString goalState READ goalState WRITE setGoalState NOTIFY goalStateChanged) Q_PROPERTY(bool jump READ jump WRITE setJump NOTIFY jumpChanged) Q_PROPERTY(bool systemStates READ systemStates WRITE setSystemStates NOTIFY systemStatesChanged) + QML_NAMED_ELEMENT(SpriteGoal) public: explicit QQuickSpriteGoalAffector(QQuickItem *parent = 0); diff --git a/src/particles/qquicktargetdirection_p.h b/src/particles/qquicktargetdirection_p.h index 13e826743e..232d375d8c 100644 --- a/src/particles/qquicktargetdirection_p.h +++ b/src/particles/qquicktargetdirection_p.h @@ -51,6 +51,8 @@ // We mean it. // #include "qquickdirection_p.h" +#include <QtQml/qqml.h> + QT_BEGIN_NAMESPACE class QQuickItem; @@ -68,6 +70,7 @@ class QQuickTargetDirection : public QQuickDirection Q_PROPERTY(bool proportionalMagnitude READ proportionalMagnitude WRITE setProportionalMagnitude NOTIFY proprotionalMagnitudeChanged) Q_PROPERTY(qreal magnitude READ magnitude WRITE setMagnitude NOTIFY magnitudeChanged) Q_PROPERTY(qreal magnitudeVariation READ magnitudeVariation WRITE setMagnitudeVariation NOTIFY magnitudeVariationChanged) + QML_NAMED_ELEMENT(TargetDirection) public: explicit QQuickTargetDirection(QObject *parent = 0); diff --git a/src/particles/qquicktrailemitter_p.h b/src/particles/qquicktrailemitter_p.h index 22b96afd25..270bec52cf 100644 --- a/src/particles/qquicktrailemitter_p.h +++ b/src/particles/qquicktrailemitter_p.h @@ -64,6 +64,7 @@ class QQuickTrailEmitter : public QQuickParticleEmitter Q_PROPERTY(QQuickParticleExtruder* emitShape READ emissonShape WRITE setEmissionShape NOTIFY emissionShapeChanged) Q_PROPERTY(qreal emitHeight READ emitterYVariation WRITE setEmitterYVariation NOTIFY emitterYVariationChanged) Q_PROPERTY(qreal emitWidth READ emitterXVariation WRITE setEmitterXVariation NOTIFY emitterXVariationChanged) + QML_NAMED_ELEMENT(TrailEmitter) public: enum EmitSize { diff --git a/src/particles/qquickturbulence_p.h b/src/particles/qquickturbulence_p.h index e73f3ba153..52011381e4 100644 --- a/src/particles/qquickturbulence_p.h +++ b/src/particles/qquickturbulence_p.h @@ -62,7 +62,9 @@ class QQuickTurbulenceAffector : public QQuickParticleAffector Q_OBJECT Q_PROPERTY(qreal strength READ strength WRITE setStrength NOTIFY strengthChanged) Q_PROPERTY(QUrl noiseSource READ noiseSource WRITE setNoiseSource NOTIFY noiseSourceChanged) - public: + QML_NAMED_ELEMENT(Turbulence) + +public: explicit QQuickTurbulenceAffector(QQuickItem *parent = 0); ~QQuickTurbulenceAffector(); void affectSystem(qreal dt) override; diff --git a/src/particles/qquickwander_p.h b/src/particles/qquickwander_p.h index 0ad19d4d13..bf7acdacfb 100644 --- a/src/particles/qquickwander_p.h +++ b/src/particles/qquickwander_p.h @@ -71,6 +71,7 @@ class QQuickWanderAffector : public QQuickParticleAffector Q_PROPERTY(qreal xVariance READ xVariance WRITE setXVariance NOTIFY xVarianceChanged) Q_PROPERTY(qreal yVariance READ yVariance WRITE setYVariance NOTIFY yVarianceChanged) Q_PROPERTY(AffectableParameters affectedParameter READ affectedParameter WRITE setAffectedParameter NOTIFY affectedParameterChanged) + QML_NAMED_ELEMENT(Wander) public: enum AffectableParameters { diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp index 8a50b51b5d..a3ca48d6d9 100644 --- a/src/qml/qml/qqml.cpp +++ b/src/qml/qml/qqml.cpp @@ -96,33 +96,188 @@ QObject *QQmlPrivate::RegisterSingletonFunctor::operator()(QQmlEngine *qeng, QJS return m_object; }; +static QVector<int> availableRevisions(const QMetaObject *metaObject) +{ + QVector<int> revisions; + if (!metaObject) + return revisions; + const int propertyOffset = metaObject->propertyOffset(); + const int propertyCount = metaObject->propertyCount(); + for (int propertyIndex = propertyOffset, propertyEnd = propertyOffset + propertyCount; + propertyIndex < propertyEnd; ++propertyIndex) { + const QMetaProperty property = metaObject->property(propertyIndex); + if (int revision = property.revision()) + revisions.append(revision); + } + const int methodOffset = metaObject->methodOffset(); + const int methodCount = metaObject->methodCount(); + for (int methodIndex = methodOffset, methodEnd = methodOffset + methodCount; + methodIndex < methodEnd; ++methodIndex) { + const QMetaMethod method = metaObject->method(methodIndex); + if (int revision = method.revision()) + revisions.append(revision); + } + + // Need to also check parent meta objects, as their revisions are inherited. + if (const QMetaObject *superMeta = metaObject->superClass()) + revisions += availableRevisions(superMeta); + + return revisions; +} + /* This method is "over generalized" to allow us to (potentially) register more types of things in the future without adding exported symbols. */ int QQmlPrivate::qmlregister(RegistrationType type, void *data) { - if (type == AutoParentRegistration) { + QQmlType dtype; + switch (type) { + case AutoParentRegistration: return QQmlMetaType::registerAutoParentFunction( *reinterpret_cast<RegisterAutoParent *>(data)); - } else if (type == QmlUnitCacheHookRegistration) { + case QmlUnitCacheHookRegistration: return QQmlMetaType::registerUnitCacheHook( *reinterpret_cast<RegisterQmlUnitCacheHook *>(data)); + case TypeAndRevisionsRegistration: { + const RegisterTypeAndRevisions &type = *reinterpret_cast<RegisterTypeAndRevisions *>(data); + const char *elementName = classElementName(type.classInfoMetaObject); + const bool creatable = (elementName != nullptr) + && boolClassInfo(type.classInfoMetaObject, "QML.Creatable", true); + + const QString noCreateReason = creatable + ? QString() + : QString::fromUtf8(classInfo(type.classInfoMetaObject, "QML.UncreatableReason")); + RegisterType revisionRegistration = { + 1, + type.typeId, + type.listId, + creatable ? type.objectSize : 0, + nullptr, + noCreateReason, + type.uri, + type.versionMajor, + -1, + nullptr, + type.metaObject, + type.attachedPropertiesFunction, + type.attachedPropertiesMetaObject, + type.parserStatusCast, + type.valueSourceCast, + type.valueInterceptorCast, + type.extensionObjectCreate, + type.extensionMetaObject, + nullptr, + -1 + }; + + const int added = intClassInfo(type.classInfoMetaObject, "QML.AddedInMinorVersion", 0); + const int removed = intClassInfo(type.classInfoMetaObject, "QML.RemovedInMinorVersion", -1); + + auto revisions = availableRevisions(type.metaObject); + revisions.append(qMax(added, 0)); + if (type.attachedPropertiesMetaObject) + revisions += availableRevisions(type.attachedPropertiesMetaObject); + + std::sort(revisions.begin(), revisions.end()); + const auto it = std::unique(revisions.begin(), revisions.end()); + revisions.erase(it, revisions.end()); + + const bool typeWasRemoved = removed >= added; + for (int revision : revisions) { + if (revision < added) + continue; + + // When removed, we still add revisions, but anonymous ones + if (typeWasRemoved && revision >= removed) { + revisionRegistration.elementName = nullptr; + revisionRegistration.create = nullptr; + } else { + revisionRegistration.elementName = elementName; + revisionRegistration.create = creatable ? type.create : nullptr; + } + + // Equivalent of qmlRegisterRevision<T, revision>(...) + revisionRegistration.versionMinor = revision; + revisionRegistration.revision = revision; + revisionRegistration.customParser = type.customParserFactory(); + + qmlregister(TypeRegistration, &revisionRegistration); + } + break; } + case SingletonAndRevisionsRegistration: { + const RegisterSingletonTypeAndRevisions &type + = *reinterpret_cast<RegisterSingletonTypeAndRevisions *>(data); + const char *elementName = classElementName(type.classInfoMetaObject); + RegisterSingletonType revisionRegistration = { + QmlCurrentSingletonTypeRegistrationVersion, + type.uri, + type.versionMajor, + -1, + elementName, - QQmlType dtype; - if (type == TypeRegistration) + type.scriptApi, + nullptr, + type.instanceMetaObject, + type.typeId, + -1, + + type.generalizedQobjectApi + }; + + const int added = intClassInfo(type.classInfoMetaObject, "QML.AddedInMinorVersion", 0); + const int removed = intClassInfo(type.classInfoMetaObject, "QML.RemovedInMinorVersion", -1); + + auto revisions = availableRevisions(type.instanceMetaObject); + revisions.append(qMax(added, 0)); + + std::sort(revisions.begin(), revisions.end()); + const auto it = std::unique(revisions.begin(), revisions.end()); + revisions.erase(it, revisions.end()); + + const bool typeWasRemoved = removed >= added; + for (int revision : qAsConst(revisions)) { + if (revision < added) + continue; + + // When removed, we still add revisions, but anonymous ones + if (typeWasRemoved && revision >= removed) { + revisionRegistration.typeName = nullptr; + revisionRegistration.scriptApi = nullptr; + revisionRegistration.generalizedQobjectApi = nullptr; + } else { + revisionRegistration.typeName = elementName; + revisionRegistration.scriptApi = type.scriptApi; + revisionRegistration.generalizedQobjectApi = type.generalizedQobjectApi; + } + + // Equivalent of qmlRegisterRevision<T, revision>(...) + revisionRegistration.versionMinor = revision; + revisionRegistration.revision = revision; + + qmlregister(SingletonRegistration, &revisionRegistration); + } + break; + } + case TypeRegistration: dtype = QQmlMetaType::registerType(*reinterpret_cast<RegisterType *>(data)); - else if (type == InterfaceRegistration) + break; + case InterfaceRegistration: dtype = QQmlMetaType::registerInterface(*reinterpret_cast<RegisterInterface *>(data)); - else if (type == SingletonRegistration) + break; + case SingletonRegistration: dtype = QQmlMetaType::registerSingletonType(*reinterpret_cast<RegisterSingletonType *>(data)); - else if (type == CompositeRegistration) + break; + case CompositeRegistration: dtype = QQmlMetaType::registerCompositeType(*reinterpret_cast<RegisterCompositeType *>(data)); - else if (type == CompositeSingletonRegistration) + break; + case CompositeSingletonRegistration: dtype = QQmlMetaType::registerCompositeSingletonType(*reinterpret_cast<RegisterCompositeSingletonType *>(data)); - else + break; + default: return -1; + } if (!dtype.isValid()) return -1; @@ -148,6 +303,14 @@ void QQmlPrivate::qmlunregister(RegistrationType type, quintptr data) case CompositeSingletonRegistration: QQmlMetaType::unregisterType(data); break; + case TypeAndRevisionsRegistration: + case SingletonAndRevisionsRegistration: + // Currently unnecessary. We'd need a special data structure to hold + // URI + majorVersion and then we'd iterate the minor versions, look up the + // associated QQmlType objects by uri/elementName/major/minor and qmlunregister + // each of them. + Q_UNREACHABLE(); + break; } } diff --git a/src/qml/qml/qqml.h b/src/qml/qml/qqml.h index 6295345fa4..effa05180d 100644 --- a/src/qml/qml/qqml.h +++ b/src/qml/qml/qqml.h @@ -41,9 +41,6 @@ #define QQML_H #include <QtQml/qqmlprivate.h> -#include <QtQml/qqmlparserstatus.h> -#include <QtQml/qqmlpropertyvaluesource.h> -#include <QtQml/qqmllist.h> #include <QtCore/qbytearray.h> #include <QtCore/qmetaobject.h> @@ -51,6 +48,12 @@ #define QML_VERSION 0x020000 #define QML_VERSION_STR "2.0" +#define QML_PRIVATE_NAMESPACE \ + QT_PREPEND_NAMESPACE(QQmlPrivate) + +#define QML_REGISTER_TYPES_AND_REVISIONS \ + QT_PREPEND_NAMESPACE(qmlRegisterTypesAndRevisions) + #define QML_DECLARE_TYPE(TYPE) \ Q_DECLARE_METATYPE(TYPE *) \ Q_DECLARE_METATYPE(QQmlListProperty<TYPE>) @@ -64,6 +67,52 @@ #define QML_DECLARE_INTERFACE_HASMETATYPE(INTERFACE) \ QML_DECLARE_TYPE_HASMETATYPE(INTERFACE) +#define QML_ELEMENT \ + Q_CLASSINFO("QML.Element", "auto") + +#define QML_ANONYMOUS \ + Q_CLASSINFO("QML.Element", "anonymous") + +#define QML_NAMED_ELEMENT(NAME) \ + Q_CLASSINFO("QML.Element", #NAME) + +#define QML_UNCREATABLE(REASON) \ + Q_CLASSINFO("QML.Creatable", "false") \ + Q_CLASSINFO("QML.UncreatableReason", REASON) + +#define QML_SINGLETON \ + Q_CLASSINFO("QML.Singleton", "true") \ + enum class QmlIsSingleton {yes = true}; \ + template<typename, typename> friend struct QML_PRIVATE_NAMESPACE::QmlSingleton; \ + template<typename T, typename... Args> \ + friend void QML_REGISTER_TYPES_AND_REVISIONS(const char *uri, int versionMajor); + +#define QML_ADDED_IN_MINOR_VERSION(VERSION) \ + Q_CLASSINFO("QML.AddedInMinorVersion", #VERSION) + +#define QML_REMOVED_IN_MINOR_VERSION(VERSION) \ + Q_CLASSINFO("QML.RemovedInMinorVersion", #VERSION) + +#define QML_ATTACHED(ATTACHED_TYPE) \ + Q_CLASSINFO("QML.Attached", #ATTACHED_TYPE) \ + using QmlAttachedType = ATTACHED_TYPE; \ + template<class, class, bool> friend struct QML_PRIVATE_NAMESPACE::QmlAttached; \ + template<class> friend struct QML_PRIVATE_NAMESPACE::QmlAttachedAccessor; + +#define QML_EXTENDED(EXTENDED_TYPE) \ + Q_CLASSINFO("QML.Extended", #EXTENDED_TYPE) \ + using QmlExtendedType = EXTENDED_TYPE; \ + template<class, class> friend struct QML_PRIVATE_NAMESPACE::QmlExtended; \ + template<typename T, typename... Args> \ + friend void QML_REGISTER_TYPES_AND_REVISIONS(const char *uri, int versionMajor); + +#define QML_FOREIGN(FOREIGN_TYPE) \ + Q_CLASSINFO("QML.Foreign", #FOREIGN_TYPE) \ + using QmlForeignType = FOREIGN_TYPE; \ + template<class, class> friend struct QML_PRIVATE_NAMESPACE::QmlResolved; \ + template<typename T, typename... Args> \ + friend void QML_REGISTER_TYPES_AND_REVISIONS(const char *uri, int versionMajor); + enum { /* TYPEINFO flags */ QML_HAS_ATTACHED_PROPERTIES = 0x01 }; @@ -82,25 +131,11 @@ QT_END_NAMESPACE QT_BEGIN_NAMESPACE - -class QQmlPropertyValueInterceptor; - -#define QML_GETTYPENAMES \ - const char *className = T::staticMetaObject.className(); \ - const int nameLen = int(strlen(className)); \ - QVarLengthArray<char,48> pointerName(nameLen+2); \ - memcpy(pointerName.data(), className, size_t(nameLen)); \ - pointerName[nameLen] = '*'; \ - pointerName[nameLen+1] = '\0'; \ - const int listLen = int(strlen("QQmlListProperty<")); \ - QVarLengthArray<char,64> listName(listLen + nameLen + 2); \ - memcpy(listName.data(), "QQmlListProperty<", size_t(listLen)); \ - memcpy(listName.data()+listLen, className, size_t(nameLen)); \ - listName[listLen+nameLen] = '>'; \ - listName[listLen+nameLen+1] = '\0'; - void Q_QML_EXPORT qmlClearTypeRegistrations(); +template<class T> +QQmlCustomParser *qmlCreateCustomParser(); + template<typename T> int qmlRegisterAnonymousType(const char *uri, int versionMajor) { @@ -720,6 +755,44 @@ inline int qmlRegisterType(const QUrl &url, const char *uri, int versionMajor, i return QQmlPrivate::qmlregister(QQmlPrivate::CompositeRegistration, &type); } +template<class T, class Resolved, class Extended, bool Singleton> +struct QmlTypeAndRevisionsRegistration; + +template<class T, class Resolved, class Extended> +struct QmlTypeAndRevisionsRegistration<T, Resolved, Extended, false> { + static void registerTypeAndRevisions(const char *uri, int versionMajor) + { + QQmlPrivate::qmlRegisterTypeAndRevisions<Resolved, Extended>( + uri, versionMajor, &T::staticMetaObject); + } +}; + +template<class T, class Resolved> +struct QmlTypeAndRevisionsRegistration<T, Resolved, void, true> { + static void registerTypeAndRevisions(const char *uri, int versionMajor) + { + QQmlPrivate::qmlRegisterSingletonAndRevisions<Resolved>( + uri, versionMajor, &T::staticMetaObject); + } +}; + +template<typename T = void, typename... Args> +void qmlRegisterTypesAndRevisions(const char *uri, int versionMajor); + +template<typename T, typename... Args> +void qmlRegisterTypesAndRevisions(const char *uri, int versionMajor) +{ + QmlTypeAndRevisionsRegistration< + T, typename QQmlPrivate::QmlResolved<T>::Type, + typename QQmlPrivate::QmlExtended<T>::Type, + QQmlPrivate::QmlSingleton<T>::Value> + ::registerTypeAndRevisions(uri, versionMajor); + qmlRegisterTypesAndRevisions<Args...>(uri, versionMajor); +} + +template<> +inline void qmlRegisterTypesAndRevisions<>(const char *, int) {} + int Q_QML_EXPORT qmlTypeId(const char *uri, int versionMajor, int versionMinor, const char *qmlName); QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlcomponent.h b/src/qml/qml/qqmlcomponent.h index f259c99b08..cb5d5a787c 100644 --- a/src/qml/qml/qqmlcomponent.h +++ b/src/qml/qml/qqmlcomponent.h @@ -70,6 +70,9 @@ class Q_QML_EXPORT QQmlComponent : public QObject Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) Q_PROPERTY(Status status READ status NOTIFY statusChanged) Q_PROPERTY(QUrl url READ url CONSTANT) + QML_NAMED_ELEMENT(Component) + QML_ATTACHED(QQmlComponentAttached) + Q_CLASSINFO("QML.Builtin", "QML") public: enum CompilationMode { PreferSynchronous, Asynchronous }; @@ -136,9 +139,29 @@ private: friend class QQmlObjectCreator; }; -QT_END_NAMESPACE +// Don't do this at home. +namespace QQmlPrivate { + +// Generally you cannot use QQmlComponentAttached as attached properties object in derived classes. +// It is private. +template<class T> +struct OverridableAttachedType<T, QQmlComponentAttached> +{ + using Type = void; +}; + +// QQmlComponent itself is allowed to use QQmlComponentAttached, though. +template<> +struct OverridableAttachedType<QQmlComponent, QQmlComponentAttached> +{ + using Type = QQmlComponentAttached; +}; + +} // namespace QQmlPrivate + + +QT_END_NAMESPACE QML_DECLARE_TYPE(QQmlComponent) -QML_DECLARE_TYPEINFO(QQmlComponent, QML_HAS_ATTACHED_PROPERTIES) #endif // QQMLCOMPONENT_H diff --git a/src/qml/qml/qqmlcomponentattached_p.h b/src/qml/qml/qqmlcomponentattached_p.h index e3bca18857..8ecd9da17d 100644 --- a/src/qml/qml/qqmlcomponentattached_p.h +++ b/src/qml/qml/qqmlcomponentattached_p.h @@ -61,6 +61,11 @@ QT_BEGIN_NAMESPACE class Q_QML_PRIVATE_EXPORT QQmlComponentAttached : public QObject { Q_OBJECT + + // Used as attached object for QQmlComponent. We want qqmlcomponentattached_p.h to be #include'd + // when registering QQmlComponent, but we cannot #include it from qqmlcomponent.h. Therefore we + // force an anonymous type registration here. + QML_ANONYMOUS public: QQmlComponentAttached(QObject *parent = nullptr); ~QQmlComponentAttached(); diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 0fd07ea209..af44d737a2 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -201,33 +201,26 @@ void QQmlEnginePrivate::defineModule() { const char uri[] = "QtQml"; - qmlRegisterType<QQmlComponent>(uri, 2, 0, "Component"); - qmlRegisterType<QObject>(uri, 2, 0, "QtObject"); - qmlRegisterType<QQmlBind>(uri, 2, 0, "Binding"); - qmlRegisterType<QQmlBind, 8>(uri, 2, 8, "Binding"); // Only available in >= 2.8 - qmlRegisterType<QQmlBind, 14>(uri, 2, 14, "Binding"); - - // TODO: We won't need Connections to be a custom type anymore once we can drop the - // automatic signal handler inference from undeclared properties. - qmlRegisterCustomType<QQmlConnections>(uri, 2, 0, "Connections", new QQmlConnectionsParser); - qmlRegisterCustomType<QQmlConnections, 3>(uri, 2, 3, "Connections", new QQmlConnectionsParser); // Only available in QtQml >= 2.3 - + qmlRegisterTypesAndRevisions< + QObjectForeign, #if QT_CONFIG(qml_animation) - qmlRegisterType<QQmlTimer>(uri, 2, 0, "Timer"); + QQmlTimer, #endif - - qmlRegisterType<QQmlLoggingCategory>(uri, 2, 8, "LoggingCategory"); // Only available in >= 2.8 - qmlRegisterType<QQmlLoggingCategory, 12>(uri, 2, 12, "LoggingCategory"); // Only available in >= 2.12 - #if QT_CONFIG(qml_locale) - qmlRegisterUncreatableType<QQmlLocale>(uri, 2, 2, "Locale", QQmlEngine::tr("Locale cannot be instantiated. Use Qt.locale()")); + QQmlLocale, #endif + QQmlComponent, + QQmlBind, + QQmlConnections, + QQmlLoggingCategory + >(uri, 2); } #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) void QQmlEnginePrivate::registerQuickTypes() { // Don't add anything here. These are only for backwards compatibility. + // Also, don't use qmlRegisterTypesAndRevisions as that will auto-add future revisions. const char uri[] = "QtQuick"; @@ -236,13 +229,17 @@ void QQmlEnginePrivate::registerQuickTypes() qmlRegisterType<QQmlBind>(uri, 2, 0, "Binding"); qmlRegisterType<QQmlBind, 8>(uri, 2, 8, "Binding"); qmlRegisterCustomType<QQmlConnections>(uri, 2, 0, "Connections", new QQmlConnectionsParser); + + // Connections revision 3 was added in QtQml 2.3, but only in QtQuick 2.7. qmlRegisterCustomType<QQmlConnections, 3>(uri, 2, 7, "Connections", new QQmlConnectionsParser); + #if QT_CONFIG(qml_animation) qmlRegisterType<QQmlTimer>(uri, 2, 0,"Timer"); #endif qmlRegisterType<QQmlLoggingCategory>(uri, 2, 8, "LoggingCategory"); qmlRegisterType<QQmlLoggingCategory, 12>(uri, 2, 12, "LoggingCategory"); #if QT_CONFIG(qml_locale) + // Locale was added in QtQuick 2.0 and in QtQml 2.2 qmlRegisterUncreatableType<QQmlLocale>(uri, 2, 0, "Locale", QQmlEngine::tr("Locale cannot be instantiated. Use Qt.locale()")); #endif } diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h index 385ae02ce5..5b1b676c89 100644 --- a/src/qml/qml/qqmlengine_p.h +++ b/src/qml/qml/qqmlengine_p.h @@ -101,6 +101,13 @@ class QQmlProfiler; class QQmlPropertyCapture; class QQmlMetaObject; +struct QObjectForeign { + Q_GADGET + QML_FOREIGN(QObject) + QML_NAMED_ELEMENT(QtObject) + Q_CLASSINFO("QML.Root", "QML") +}; + // This needs to be declared here so that the pool for it can live in QQmlEnginePrivate. // The inline method definitions are in qqmljavascriptexpression_p.h class QQmlJavaScriptExpressionGuard : public QQmlNotifierEndpoint diff --git a/src/qml/qml/qqmllocale_p.h b/src/qml/qml/qqmllocale_p.h index 859c36e11b..10e0dfcc38 100644 --- a/src/qml/qml/qqmllocale_p.h +++ b/src/qml/qml/qqmllocale_p.h @@ -94,6 +94,9 @@ private: class Q_QML_PRIVATE_EXPORT QQmlLocale { Q_GADGET + QML_NAMED_ELEMENT(Locale) + QML_UNCREATABLE("Locale cannot be instantiated. Use Qt.locale().") + QML_ADDED_IN_MINOR_VERSION(2) public: ~QQmlLocale(); diff --git a/src/qml/qml/qqmlloggingcategory_p.h b/src/qml/qml/qqmlloggingcategory_p.h index ee5d9af2e7..c7377528b4 100644 --- a/src/qml/qml/qqmlloggingcategory_p.h +++ b/src/qml/qml/qqmlloggingcategory_p.h @@ -56,6 +56,7 @@ #include <QtCore/qloggingcategory.h> #include <QtQml/qqmlparserstatus.h> +#include <QtQml/qqml.h> QT_BEGIN_NAMESPACE @@ -66,6 +67,8 @@ class QQmlLoggingCategory : public QObject, public QQmlParserStatus Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(DefaultLogLevel defaultLogLevel READ defaultLogLevel WRITE setDefaultLogLevel REVISION 12) + QML_NAMED_ELEMENT(LoggingCategory) + QML_ADDED_IN_MINOR_VERSION(8) public: enum DefaultLogLevel { diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index c2674b402a..268d58a856 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -154,7 +154,7 @@ static QQmlTypePrivate *createQQmlType(QQmlMetaTypeData *data, const QString &el d->extraData.cd->propertyValueSourceCast = type.valueSourceCast; d->extraData.cd->propertyValueInterceptorCast = type.valueInterceptorCast; d->extraData.cd->extFunc = type.extensionObjectCreate; - d->extraData.cd->customParser = type.customParser; + d->extraData.cd->customParser = reinterpret_cast<QQmlCustomParser *>(type.customParser); d->extraData.cd->registerEnumClassesUnscoped = true; if (type.extensionMetaObject) diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h index e6dd5e0b16..8111178320 100644 --- a/src/qml/qml/qqmlprivate.h +++ b/src/qml/qml/qqmlprivate.h @@ -52,17 +52,42 @@ // #include <functional> +#include <type_traits> #include <QtQml/qtqmlglobal.h> +#include <QtQml/qqmlparserstatus.h> +#include <QtQml/qqmllist.h> +#include <QtQml/qqmlpropertyvaluesource.h> #include <QtCore/qglobal.h> #include <QtCore/qvariant.h> #include <QtCore/qurl.h> +#include <QtCore/qmetaobject.h> +#include <QtCore/qdebug.h> + +#define QML_GETTYPENAMES \ + const char *className = T::staticMetaObject.className(); \ + const int nameLen = int(strlen(className)); \ + QVarLengthArray<char,48> pointerName(nameLen+2); \ + memcpy(pointerName.data(), className, size_t(nameLen)); \ + pointerName[nameLen] = '*'; \ + pointerName[nameLen+1] = '\0'; \ + const int listLen = int(strlen("QQmlListProperty<")); \ + QVarLengthArray<char,64> listName(listLen + nameLen + 2); \ + memcpy(listName.data(), "QQmlListProperty<", size_t(listLen)); \ + memcpy(listName.data()+listLen, className, size_t(nameLen)); \ + listName[listLen+nameLen] = '>'; \ + listName[listLen+nameLen+1] = '\0'; + QT_BEGIN_NAMESPACE +class QQmlPropertyValueInterceptor; + namespace QQmlPrivate { struct CachedQmlUnit; +template<typename A> +using QQmlAttachedPropertiesFunc = A *(*)(QObject *); } namespace QV4 { @@ -77,7 +102,7 @@ struct Document; typedef void (*IRLoaderFunction)(Document *, const QQmlPrivate::CachedQmlUnit *); } -typedef QObject *(*QQmlAttachedPropertiesFunc)(QObject *); +using QQmlAttachedPropertiesFunc = QQmlPrivate::QQmlAttachedPropertiesFunc<QObject>; inline uint qHash(QQmlAttachedPropertiesFunc func, uint seed = 0) { @@ -98,6 +123,13 @@ class QJSValue; class QJSEngine; class QQmlEngine; class QQmlCustomParser; + +template<class T> +QQmlCustomParser *qmlCreateCustomParser() +{ + return nullptr; +} + namespace QQmlPrivate { void Q_QML_EXPORT qdeclarativeelement_destructor(QObject *); @@ -123,11 +155,62 @@ namespace QQmlPrivate }; template<typename T> + constexpr bool isConstructible() + { + return std::is_default_constructible<T>::value && std::is_base_of<QObject, T>::value; + } + + template<typename T> void createInto(void *memory) { new (memory) QQmlElement<T>; } template<typename T> + QObject *createSingletonInstance(QQmlEngine *, QJSEngine *) { return new T; } + + template<typename T> QObject *createParent(QObject *p) { return new T(p); } + using CreateIntoFunction = void (*)(void *); + using CreateSingletonFunction = QObject *(*)(QQmlEngine *, QJSEngine *); + using CreateParentFunction = QObject *(*)(QObject *); + + template<typename T, bool Constructible = isConstructible<T>()> + struct Constructors; + + template<typename T> + struct Constructors<T, true> + { + static constexpr CreateIntoFunction createInto + = QQmlPrivate::createInto<T>; + static constexpr CreateSingletonFunction createSingletonInstance + = QQmlPrivate::createSingletonInstance<T>; + }; + + template<typename T> + struct Constructors<T, false> + { + static constexpr CreateIntoFunction createInto = nullptr; + static constexpr CreateSingletonFunction createSingletonInstance = nullptr; + }; + + template<typename T, bool IsVoid = std::is_void<T>::value> + struct ExtendedType; + + // void means "not an extended type" + template<typename T> + struct ExtendedType<T, true> + { + static constexpr const CreateParentFunction createParent = nullptr; + static constexpr const QMetaObject *staticMetaObject = nullptr; + }; + + // If it's not void, we actually want an error if the ctor or the metaobject is missing. + template<typename T> + struct ExtendedType<T, false> + { + static constexpr const CreateParentFunction createParent = QQmlPrivate::createParent<T>; + static constexpr const QMetaObject *staticMetaObject = &T::staticMetaObject; + }; + template<class From, class To, int N> struct StaticCastSelectorClass { @@ -155,66 +238,103 @@ namespace QQmlPrivate } }; - template <typename T> - struct has_attachedPropertiesMember + template<typename...> + using QmlVoidT = void; + + // You can prevent subclasses from using the same attached type by specialzing this. + // This is reserved for internal types, though. + template<class T, class A> + struct OverridableAttachedType { - static bool const value = QQmlTypeInfo<T>::hasAttachedProperties; + using Type = A; }; - template <typename T, bool hasMember> - class has_attachedPropertiesMethod + template<class T, class = QmlVoidT<>, bool OldStyle = QQmlTypeInfo<T>::hasAttachedProperties> + struct QmlAttached { - public: - typedef int yes_type; - typedef char no_type; - - template<typename ReturnType> - static yes_type checkType(ReturnType *(*)(QObject *)); - static no_type checkType(...); - - static bool const value = sizeof(checkType(&T::qmlAttachedProperties)) == sizeof(yes_type); + using Type = void; + using Func = QQmlAttachedPropertiesFunc<QObject>; + static const QMetaObject *staticMetaObject() { return nullptr; } + static Func attachedPropertiesFunc() { return nullptr; } }; - template <typename T> - class has_attachedPropertiesMethod<T, false> + // Defined inline via QML_ATTACHED + template<class T> + struct QmlAttached<T, QmlVoidT<typename OverridableAttachedType<T, typename T::QmlAttachedType>::Type>, false> { - public: - static bool const value = false; + // Normal attached properties + template <typename Parent, typename Attached> + struct Properties + { + using Func = QQmlAttachedPropertiesFunc<Attached>; + static const QMetaObject *staticMetaObject() { return &Attached::staticMetaObject; } + static Func attachedPropertiesFunc() { return Parent::qmlAttachedProperties; } + }; + + // Disabled via OverridableAttachedType + template<typename Parent> + struct Properties<Parent, void> + { + using Func = QQmlAttachedPropertiesFunc<QObject>; + static const QMetaObject *staticMetaObject() { return nullptr; }; + static Func attachedPropertiesFunc() { return nullptr; }; + }; + + using Type = typename OverridableAttachedType<T, typename T::QmlAttachedType>::Type; + using Func = typename Properties<T, Type>::Func; + + static const QMetaObject *staticMetaObject() + { + return Properties<T, Type>::staticMetaObject(); + } + + static Func attachedPropertiesFunc() + { + return Properties<T, Type>::attachedPropertiesFunc(); + } }; - template<typename T, int N> - class AttachedPropertySelector + // Separately defined via QQmlTypeInfo + template<class T> + struct QmlAttached<T, QmlVoidT<decltype(T::qmlAttachedProperties)>, true> { - public: - static inline QQmlAttachedPropertiesFunc func() { return nullptr; } - static inline const QMetaObject *metaObject() { return nullptr; } + using Type = typename std::remove_pointer<decltype(T::qmlAttachedProperties(nullptr))>::type; + using Func = QQmlAttachedPropertiesFunc<Type>; + + static const QMetaObject *staticMetaObject() { return &Type::staticMetaObject; } + static Func attachedPropertiesFunc() { return T::qmlAttachedProperties; } }; - template<typename T> - class AttachedPropertySelector<T, 1> + + // This is necessary because both the type containing a default template parameter and the type + // instantiating the template need to have access to the default template parameter type. In + // this case that's T::QmlAttachedType. The QML_FOREIGN macro needs to befriend specific other + // types. Therefore we need some kind of "accessor". Because of compiler bugs in gcc and clang, + // we cannot befriend attachedPropertiesFunc() directly. Wrapping the actual access into another + // struct "fixes" that. For convenience we still want the free standing functions in addition. + template<class T> + struct QmlAttachedAccessor { - template<typename ReturnType> - static inline const QMetaObject *attachedPropertiesMetaObject(ReturnType *(*)(QObject *)) { - return &ReturnType::staticMetaObject; - } - public: - static inline QQmlAttachedPropertiesFunc func() { - return QQmlAttachedPropertiesFunc(&T::qmlAttachedProperties); + static QQmlAttachedPropertiesFunc<QObject> attachedPropertiesFunc() + { + return QQmlAttachedPropertiesFunc<QObject>(QmlAttached<T>::attachedPropertiesFunc()); } - static inline const QMetaObject *metaObject() { - return attachedPropertiesMetaObject(&T::qmlAttachedProperties); + + static const QMetaObject *staticMetaObject() + { + return QmlAttached<T>::staticMetaObject(); } }; template<typename T> - inline QQmlAttachedPropertiesFunc attachedPropertiesFunc() + inline QQmlAttachedPropertiesFunc<QObject> attachedPropertiesFunc() { - return AttachedPropertySelector<T, has_attachedPropertiesMethod<T, has_attachedPropertiesMember<T>::value>::value>::func(); + return QmlAttachedAccessor<T>::attachedPropertiesFunc(); } template<typename T> inline const QMetaObject *attachedPropertiesMetaObject() { - return AttachedPropertySelector<T, has_attachedPropertiesMethod<T, has_attachedPropertiesMember<T>::value>::value>::metaObject(); + return QmlAttachedAccessor<T>::staticMetaObject(); } enum AutoParentResult { Parented, IncompatibleObject, IncompatibleParent }; @@ -235,7 +355,7 @@ namespace QQmlPrivate const char *elementName; const QMetaObject *metaObject; - QQmlAttachedPropertiesFunc attachedPropertiesFunction; + QQmlAttachedPropertiesFunc<QObject> attachedPropertiesFunction; const QMetaObject *attachedPropertiesMetaObject; int parserStatusCast; @@ -246,10 +366,38 @@ namespace QQmlPrivate const QMetaObject *extensionMetaObject; QQmlCustomParser *customParser; + int revision; // If this is extended ensure "version" is bumped!!! }; + struct RegisterTypeAndRevisions { + int version; + + int typeId; + int listId; + int objectSize; + void (*create)(void *); + + const char *uri; + int versionMajor; + + const QMetaObject *metaObject; + const QMetaObject *classInfoMetaObject; + + QQmlAttachedPropertiesFunc<QObject> attachedPropertiesFunction; + const QMetaObject *attachedPropertiesMetaObject; + + int parserStatusCast; + int valueSourceCast; + int valueInterceptorCast; + + QObject *(*extensionObjectCreate)(QObject *); + const QMetaObject *extensionMetaObject; + + QQmlCustomParser *(*customParserFactory)(); + }; + struct RegisterInterface { int version; @@ -282,6 +430,19 @@ namespace QQmlPrivate // If this is extended ensure "version" is bumped!!! }; + struct RegisterSingletonTypeAndRevisions { + int version; + const char *uri; + int versionMajor; + + QJSValue (*scriptApi)(QQmlEngine *, QJSEngine *); + const QMetaObject *instanceMetaObject; + const QMetaObject *classInfoMetaObject; + + int typeId; + std::function<QObject*(QQmlEngine *, QJSEngine *)> generalizedQobjectApi; // new in version 3 + }; + struct RegisterCompositeType { QUrl url; const char *uri; @@ -317,7 +478,9 @@ namespace QQmlPrivate SingletonRegistration = 3, CompositeRegistration = 4, CompositeSingletonRegistration = 5, - QmlUnitCacheHookRegistration = 6 + QmlUnitCacheHookRegistration = 6, + TypeAndRevisionsRegistration = 7, + SingletonAndRevisionsRegistration = 8 }; int Q_QML_EXPORT qmlregister(RegistrationType, void *); @@ -329,7 +492,151 @@ namespace QQmlPrivate QObject *m_object; bool alreadyCalled = false; }; -} + + static int indexOfOwnClassInfo(const QMetaObject *metaObject, const char *key) + { + if (!metaObject || !key) + return -1; + + const int offset = metaObject->classInfoOffset(); + for (int i = metaObject->classInfoCount() + offset - 1; i >= offset; --i) + if (qstrcmp(key, metaObject->classInfo(i).name()) == 0) { + return i; + } + return -1; + } + + inline const char *classInfo(const QMetaObject *metaObject, const char *key) + { + return metaObject->classInfo(indexOfOwnClassInfo(metaObject, key)).value(); + } + + inline int intClassInfo(const QMetaObject *metaObject, const char *key, int defaultValue = 0) + { + const int index = indexOfOwnClassInfo(metaObject, key); + return (index == -1) ? defaultValue + : QByteArray(metaObject->classInfo(index).value()).toInt(); + } + + inline bool boolClassInfo(const QMetaObject *metaObject, const char *key, + bool defaultValue = false) + { + const int index = indexOfOwnClassInfo(metaObject, key); + return (index == -1) ? defaultValue + : (QByteArray(metaObject->classInfo(index).value()) == "true"); + } + + inline const char *classElementName(const QMetaObject *metaObject) + { + const char *elementName = classInfo(metaObject, "QML.Element"); + if (qstrcmp(elementName, "auto") == 0) + return metaObject->className(); + if (qstrcmp(elementName, "anonymous") == 0) + return nullptr; + + if (!elementName || elementName[0] < 'A' || elementName[0] > 'Z') { + qWarning() << "Missing or unusable QML.Element class info \"" << elementName << "\"" + << "for" << metaObject->className(); + } + + return elementName; + } + + template<class T, class = QmlVoidT<>> + struct QmlExtended + { + using Type = void; + }; + + template<class T> + struct QmlExtended<T, QmlVoidT<typename T::QmlExtendedType>> + { + using Type = typename T::QmlExtendedType; + }; + + template<class T, class = QmlVoidT<>> + struct QmlResolved + { + using Type = T; + }; + + template<class T> + struct QmlResolved<T, QmlVoidT<typename T::QmlForeignType>> + { + using Type = typename T::QmlForeignType; + }; + + template<class T, class = QmlVoidT<>> + struct QmlSingleton + { + static constexpr bool Value = false; + }; + + template<class T> + struct QmlSingleton<T, QmlVoidT<typename T::QmlIsSingleton>> + { + static constexpr bool Value = bool(T::QmlIsSingleton::yes); + }; + + template<typename T> + void qmlRegisterSingletonAndRevisions(const char *uri, int versionMajor, + const QMetaObject *classInfoMetaObject) + { + QML_GETTYPENAMES + + RegisterSingletonTypeAndRevisions api = { + 0, + + uri, + versionMajor, + + nullptr, + + &T::staticMetaObject, + classInfoMetaObject, + + qRegisterNormalizedMetaType<T *>(pointerName.constData()), + Constructors<T>::createSingletonInstance + }; + + qmlregister(SingletonAndRevisionsRegistration, &api); + } + + template<typename T, typename E> + void qmlRegisterTypeAndRevisions(const char *uri, int versionMajor, + const QMetaObject *classInfoMetaObject) + { + QML_GETTYPENAMES + + RegisterTypeAndRevisions type = { + 0, + qRegisterNormalizedMetaType<T *>(pointerName.constData()), + qRegisterNormalizedMetaType<QQmlListProperty<T> >(listName.constData()), + int(sizeof(T)), + Constructors<T>::createInto, + + uri, + versionMajor, + + &T::staticMetaObject, + classInfoMetaObject, + + attachedPropertiesFunc<T>(), + attachedPropertiesMetaObject<T>(), + + StaticCastSelector<T, QQmlParserStatus>::cast(), + StaticCastSelector<T, QQmlPropertyValueSource>::cast(), + StaticCastSelector<T, QQmlPropertyValueInterceptor>::cast(), + + ExtendedType<E>::createParent, + ExtendedType<E>::staticMetaObject, + + &qmlCreateCustomParser<T> + }; + + qmlregister(TypeAndRevisionsRegistration, &type); + } +} // namespace QQmlPrivate QT_END_NAMESPACE diff --git a/src/qml/qml/qqmltypenotavailable_p.h b/src/qml/qml/qqmltypenotavailable_p.h index 33630bf507..8db5876b10 100644 --- a/src/qml/qml/qqmltypenotavailable_p.h +++ b/src/qml/qml/qqmltypenotavailable_p.h @@ -58,6 +58,9 @@ QT_BEGIN_NAMESPACE class QQmlTypeNotAvailable : public QObject { Q_OBJECT + QML_NAMED_ELEMENT(TypeNotAvailable) + QML_UNCREATABLE("Type not available.") + public: QQmlTypeNotAvailable(); }; diff --git a/src/qml/qml/qqmlvaluetype_p.h b/src/qml/qml/qqmlvaluetype_p.h index cf53b8cb4a..9c008859da 100644 --- a/src/qml/qml/qqmlvaluetype_p.h +++ b/src/qml/qml/qqmlvaluetype_p.h @@ -215,6 +215,8 @@ struct QQmlEasingValueType { QEasingCurve v; Q_GADGET + QML_NAMED_ELEMENT(Easing) + QML_UNCREATABLE("Use the Type enum.") Q_PROPERTY(QQmlEasingValueType::Type type READ type WRITE setType FINAL) Q_PROPERTY(qreal amplitude READ amplitude WRITE setAmplitude FINAL) diff --git a/src/qml/types/qqmlbind_p.h b/src/qml/types/qqmlbind_p.h index 22007a3d25..e7c7e01a0d 100644 --- a/src/qml/types/qqmlbind_p.h +++ b/src/qml/types/qqmlbind_p.h @@ -81,6 +81,7 @@ private: Q_PROPERTY(RestorationMode restoreMode READ restoreMode WRITE setRestoreMode NOTIFY restoreModeChanged REVISION 14) Q_ENUM(RestorationMode) + QML_NAMED_ELEMENT(Binding) public: QQmlBind(QObject *parent=nullptr); diff --git a/src/qml/types/qqmlconnections_p.h b/src/qml/types/qqmlconnections_p.h index 5d28e8e8be..7bf688cf75 100644 --- a/src/qml/types/qqmlconnections_p.h +++ b/src/qml/types/qqmlconnections_p.h @@ -71,6 +71,7 @@ class Q_AUTOTEST_EXPORT QQmlConnections : public QObject, public QQmlParserStatu Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged REVISION 3) Q_PROPERTY(bool ignoreUnknownSignals READ ignoreUnknownSignals WRITE setIgnoreUnknownSignals) + QML_NAMED_ELEMENT(Connections) public: QQmlConnections(QObject *parent=nullptr); @@ -106,6 +107,13 @@ public: void applyBindings(QObject *object, const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) override; }; +// TODO: We won't need Connections to be a custom type anymore once we can drop the +// automatic signal handler inference from undeclared properties. +template<> +inline QQmlCustomParser *qmlCreateCustomParser<QQmlConnections>() +{ + return new QQmlConnectionsParser; +} QT_END_NAMESPACE diff --git a/src/qml/types/qqmltimer_p.h b/src/qml/types/qqmltimer_p.h index 0160e97a2f..0cd93e4659 100644 --- a/src/qml/types/qqmltimer_p.h +++ b/src/qml/types/qqmltimer_p.h @@ -72,6 +72,7 @@ class Q_QML_PRIVATE_EXPORT QQmlTimer : public QObject, public QQmlParserStatus Q_PROPERTY(bool repeat READ isRepeating WRITE setRepeating NOTIFY repeatChanged) Q_PROPERTY(bool triggeredOnStart READ triggeredOnStart WRITE setTriggeredOnStart NOTIFY triggeredOnStartChanged) Q_PROPERTY(QObject *parent READ parent CONSTANT) + QML_NAMED_ELEMENT(Timer) public: QQmlTimer(QObject *parent=nullptr); diff --git a/src/qmlmodels/qqmldelegatecomponent_p.h b/src/qmlmodels/qqmldelegatecomponent_p.h index 1d20f0327b..86ad04d2e3 100644 --- a/src/qmlmodels/qqmldelegatecomponent_p.h +++ b/src/qmlmodels/qqmldelegatecomponent_p.h @@ -64,6 +64,9 @@ class QQmlAdaptorModel; class Q_QMLMODELS_PRIVATE_EXPORT QQmlAbstractDelegateComponent : public QQmlComponent { Q_OBJECT + QML_NAMED_ELEMENT(AbstractDelegateComponent) + QML_UNCREATABLE("Cannot create instance of abstract class AbstractDelegateComponent.") + public: QQmlAbstractDelegateComponent(QObject *parent = nullptr); ~QQmlAbstractDelegateComponent() override; @@ -90,6 +93,7 @@ class Q_QMLMODELS_PRIVATE_EXPORT QQmlDelegateChoice : public QObject Q_PROPERTY(int column READ column WRITE setColumn NOTIFY columnChanged) Q_PROPERTY(QQmlComponent* delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) Q_CLASSINFO("DefaultProperty", "delegate") + QML_NAMED_ELEMENT(DelegateChoice) public: QVariant roleValue() const; void setRoleValue(const QVariant &roleValue); @@ -126,6 +130,7 @@ class Q_QMLMODELS_PRIVATE_EXPORT QQmlDelegateChooser : public QQmlAbstractDelega Q_PROPERTY(QString role READ role WRITE setRole NOTIFY roleChanged) Q_PROPERTY(QQmlListProperty<QQmlDelegateChoice> choices READ choices CONSTANT) Q_CLASSINFO("DefaultProperty", "choices") + QML_NAMED_ELEMENT(DelegateChooser) public: QString role() const { return m_role; } diff --git a/src/qmlmodels/qqmldelegatemodel_p.h b/src/qmlmodels/qqmldelegatemodel_p.h index 21eaef02e0..7492f2b77d 100644 --- a/src/qmlmodels/qqmldelegatemodel_p.h +++ b/src/qmlmodels/qqmldelegatemodel_p.h @@ -85,7 +85,11 @@ class Q_QMLMODELS_PRIVATE_EXPORT QQmlDelegateModel : public QQmlInstanceModel, p Q_PROPERTY(QObject *parts READ parts CONSTANT) Q_PROPERTY(QVariant rootIndex READ rootIndex WRITE setRootIndex NOTIFY rootIndexChanged) Q_CLASSINFO("DefaultProperty", "delegate") + QML_NAMED_ELEMENT(DelegateModel) + QML_ADDED_IN_MINOR_VERSION(1) + QML_ATTACHED(QQmlDelegateModelAttached) Q_INTERFACES(QQmlParserStatus) + public: QQmlDelegateModel(); QQmlDelegateModel(QQmlContext *, QObject *parent=nullptr); @@ -163,6 +167,8 @@ class Q_QMLMODELS_PRIVATE_EXPORT QQmlDelegateModelGroup : public QObject Q_PROPERTY(int count READ count NOTIFY countChanged) Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(bool includeByDefault READ defaultInclude WRITE setDefaultInclude NOTIFY defaultIncludeChanged) + QML_NAMED_ELEMENT(DelegateModelGroup) + QML_ADDED_IN_MINOR_VERSION(1) public: QQmlDelegateModelGroup(QObject *parent = nullptr); QQmlDelegateModelGroup(const QString &name, QQmlDelegateModel *model, int compositorType, QObject *parent = nullptr); @@ -240,7 +246,6 @@ public: QT_END_NAMESPACE QML_DECLARE_TYPE(QQmlDelegateModel) -QML_DECLARE_TYPEINFO(QQmlDelegateModel, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QQmlDelegateModelGroup) #endif // QQMLDATAMODEL_P_H diff --git a/src/qmlmodels/qqmlinstantiator_p.h b/src/qmlmodels/qqmlinstantiator_p.h index 87accc304f..60b611128d 100644 --- a/src/qmlmodels/qqmlinstantiator_p.h +++ b/src/qmlmodels/qqmlinstantiator_p.h @@ -72,6 +72,8 @@ class Q_QMLMODELS_PRIVATE_EXPORT QQmlInstantiator : public QObject, public QQmlP Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) Q_PROPERTY(QObject *object READ object NOTIFY objectChanged) Q_CLASSINFO("DefaultProperty", "delegate") + QML_NAMED_ELEMENT(Instantiator) + QML_ADDED_IN_MINOR_VERSION(14) public: QQmlInstantiator(QObject *parent = nullptr); diff --git a/src/qmlmodels/qqmllistmodel_p.h b/src/qmlmodels/qqmllistmodel_p.h index 10d67c1c6f..9a4358ac6f 100644 --- a/src/qmlmodels/qqmllistmodel_p.h +++ b/src/qmlmodels/qqmllistmodel_p.h @@ -83,6 +83,8 @@ class Q_QMLMODELS_PRIVATE_EXPORT QQmlListModel : public QAbstractListModel Q_PROPERTY(int count READ count NOTIFY countChanged) Q_PROPERTY(bool dynamicRoles READ dynamicRoles WRITE setDynamicRoles) Q_PROPERTY(QObject *agent READ agent CONSTANT REVISION(14)) + QML_NAMED_ELEMENT(ListModel) + QML_ADDED_IN_MINOR_VERSION(1) public: QQmlListModel(QObject *parent=nullptr); @@ -171,7 +173,9 @@ private: // ### FIXME class QQmlListElement : public QObject { -Q_OBJECT + Q_OBJECT + QML_NAMED_ELEMENT(ListElement) + QML_ADDED_IN_MINOR_VERSION(1) }; class QQmlListModelParser : public QQmlCustomParser @@ -201,6 +205,12 @@ private: QString listElementTypeName; }; +template<> +inline QQmlCustomParser *qmlCreateCustomParser<QQmlListModel>() +{ + return new QQmlListModelParser; +} + QT_END_NAMESPACE QML_DECLARE_TYPE(QQmlListModel) diff --git a/src/qmlmodels/qqmllistmodelworkeragent_p.h b/src/qmlmodels/qqmllistmodelworkeragent_p.h index 1ef27cea3f..f65909dcec 100644 --- a/src/qmlmodels/qqmllistmodelworkeragent_p.h +++ b/src/qmlmodels/qqmllistmodelworkeragent_p.h @@ -56,6 +56,7 @@ #include <QEvent> #include <QMutex> #include <QWaitCondition> +#include <QtQml/qqml.h> #include <private/qv4engine_p.h> @@ -71,6 +72,7 @@ class QQmlListModelWorkerAgent : public QObject Q_OBJECT Q_PROPERTY(int count READ count) Q_PROPERTY(QV4::ExecutionEngine *engine READ engine WRITE setEngine NOTIFY engineChanged) + QML_ANONYMOUS public: QQmlListModelWorkerAgent(QQmlListModel *); diff --git a/src/qmlmodels/qqmlmodelsmodule.cpp b/src/qmlmodels/qqmlmodelsmodule.cpp index d569d8e23c..5dbf84b599 100644 --- a/src/qmlmodels/qqmlmodelsmodule.cpp +++ b/src/qmlmodels/qqmlmodelsmodule.cpp @@ -40,16 +40,15 @@ #include "qqmlmodelsmodule_p.h" #include <private/qtqmlmodelsglobal_p.h> -#if QT_CONFIG(itemmodel) -#include <QtCore/qitemselectionmodel.h> -#endif #if QT_CONFIG(qml_list_model) #include <private/qqmllistmodel_p.h> +#include <private/qqmllistmodelworkeragent_p.h> #endif #if QT_CONFIG(qml_delegate_model) #include <private/qqmldelegatemodel_p.h> #include <private/qqmldelegatecomponent_p.h> #include <private/qquickpackage_p.h> +#include <private/qqmlcomponentattached_p.h> #endif #if QT_CONFIG(qml_object_model) #include <private/qqmlobjectmodel_p.h> @@ -67,6 +66,8 @@ QT_BEGIN_NAMESPACE void QQmlModelsModule::registerQmlTypes() { // Don't add anything here. These are only for backwards compatibility. + // Don't convert these to qmlRegisterTypesAndRevisions! + // -> the annotations in the headers are for the QtQml.Models module <- #if QT_CONFIG(qml_object_model) qmlRegisterType<QQmlInstantiator>("QtQml", 2, 1, "Instantiator"); // Only available in >= 2.1 qmlRegisterAnonymousType<QQmlInstanceModel>("QtQml", 2); @@ -76,6 +77,8 @@ void QQmlModelsModule::registerQmlTypes() void QQmlModelsModule::registerQuickTypes() { // Don't add anything here. These are only for backwards compatibility. + // Don't convert these to qmlRegisterTypesAndRevisions! + // -> the annotations in the headers are for the QtQml.Models module <- const char uri[] = "QtQuick"; @@ -102,22 +105,16 @@ void QQmlModelsModule::defineModule() const char uri[] = "QtQml.Models"; #if QT_CONFIG(qml_list_model) - qmlRegisterType<QQmlListElement>(uri, 2, 1, "ListElement"); - qmlRegisterCustomType<QQmlListModel>(uri, 2, 1, "ListModel", new QQmlListModelParser); + qmlRegisterTypesAndRevisions<QQmlListElement, QQmlListModel, QQmlListModelWorkerAgent>(uri, 2); #endif #if QT_CONFIG(qml_delegate_model) - qmlRegisterType<QQmlDelegateModel>(uri, 2, 1, "DelegateModel"); - qmlRegisterType<QQmlDelegateModelGroup>(uri, 2, 1, "DelegateModelGroup"); - qmlRegisterType<QQuickPackage>(uri, 2, 14, "Package"); + qmlRegisterTypesAndRevisions<QQmlDelegateModel, QQmlDelegateModelGroup, QQuickPackage>(uri, 2); #endif #if QT_CONFIG(qml_object_model) - qmlRegisterType<QQmlObjectModel>(uri, 2, 1, "ObjectModel"); - qmlRegisterType<QQmlObjectModel,3>(uri, 2, 3, "ObjectModel"); - qmlRegisterType<QQmlInstantiator>(uri, 2, 14, "Instantiator"); - qmlRegisterAnonymousType<QQmlInstanceModel>(uri, 2); + qmlRegisterTypesAndRevisions<QQmlObjectModel, QQmlInstantiator, QQmlInstanceModel>(uri, 2); #endif #if QT_CONFIG(itemmodel) - qmlRegisterType<QItemSelectionModel>(uri, 2, 2, "ItemSelectionModel"); + qmlRegisterTypesAndRevisions<QItemSelectionModelForeign>(uri, 2); #endif } @@ -126,13 +123,11 @@ void QQmlModelsModule::defineLabsModule() const char uri[] = "Qt.labs.qmlmodels"; #if QT_CONFIG(qml_delegate_model) - qmlRegisterUncreatableType<QQmlAbstractDelegateComponent>(uri, 1, 0, "AbstractDelegateComponent", QQmlAbstractDelegateComponent::tr("Cannot create instance of abstract class AbstractDelegateComponent.")); - qmlRegisterType<QQmlDelegateChooser>(uri, 1, 0, "DelegateChooser"); - qmlRegisterType<QQmlDelegateChoice>(uri, 1, 0, "DelegateChoice"); + qmlRegisterTypesAndRevisions< + QQmlAbstractDelegateComponent, QQmlDelegateChooser, QQmlDelegateChoice>(uri, 1); #endif #if QT_CONFIG(qml_table_model) - qmlRegisterType<QQmlTableModel>(uri, 1, 0, "TableModel"); - qmlRegisterType<QQmlTableModelColumn>(uri, 1, 0, "TableModelColumn"); + qmlRegisterTypesAndRevisions<QQmlTableModel, QQmlTableModelColumn>(uri, 1); #endif } diff --git a/src/qmlmodels/qqmlmodelsmodule_p.h b/src/qmlmodels/qqmlmodelsmodule_p.h index 7e02578db9..85c87b35a2 100644 --- a/src/qmlmodels/qqmlmodelsmodule_p.h +++ b/src/qmlmodels/qqmlmodelsmodule_p.h @@ -51,6 +51,12 @@ // We mean it. // +#include <QtQml/qqml.h> + +#if QT_CONFIG(itemmodel) +#include <QtCore/qitemselectionmodel.h> +#endif + #include <private/qtqmlmodelsglobal_p.h> QT_BEGIN_NAMESPACE @@ -67,6 +73,16 @@ public: static void defineLabsModule(); }; +#if QT_CONFIG(itemmodel) +struct QItemSelectionModelForeign +{ + Q_GADGET + QML_FOREIGN(QItemSelectionModel) + QML_NAMED_ELEMENT(ItemSelectionModel) + QML_ADDED_IN_MINOR_VERSION(2) +}; +#endif + QT_END_NAMESPACE #endif diff --git a/src/qmlmodels/qqmlobjectmodel_p.h b/src/qmlmodels/qqmlobjectmodel_p.h index 78a5615ae2..0aa818d724 100644 --- a/src/qmlmodels/qqmlobjectmodel_p.h +++ b/src/qmlmodels/qqmlobjectmodel_p.h @@ -69,6 +69,7 @@ class Q_QMLMODELS_PRIVATE_EXPORT QQmlInstanceModel : public QObject Q_OBJECT Q_PROPERTY(int count READ count NOTIFY countChanged) + QML_ANONYMOUS public: virtual ~QQmlInstanceModel() {} @@ -113,6 +114,9 @@ class Q_QMLMODELS_PRIVATE_EXPORT QQmlObjectModel : public QQmlInstanceModel Q_PROPERTY(QQmlListProperty<QObject> children READ children NOTIFY childrenChanged DESIGNABLE false) Q_CLASSINFO("DefaultProperty", "children") + QML_NAMED_ELEMENT(ObjectModel) + QML_ADDED_IN_MINOR_VERSION(1) + QML_ATTACHED(QQmlObjectModelAttached) public: QQmlObjectModel(QObject *parent=nullptr); @@ -191,6 +195,5 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QQmlInstanceModel) QML_DECLARE_TYPE(QQmlObjectModel) -QML_DECLARE_TYPEINFO(QQmlObjectModel, QML_HAS_ATTACHED_PROPERTIES) #endif // QQMLINSTANCEMODEL_P_H diff --git a/src/qmlmodels/qqmltablemodel_p.h b/src/qmlmodels/qqmltablemodel_p.h index b3c0cc2848..4b667e1073 100644 --- a/src/qmlmodels/qqmltablemodel_p.h +++ b/src/qmlmodels/qqmltablemodel_p.h @@ -72,6 +72,7 @@ class Q_QMLMODELS_PRIVATE_EXPORT QQmlTableModel : public QAbstractTableModel, pu Q_PROPERTY(QQmlListProperty<QQmlTableModelColumn> columns READ columns CONSTANT FINAL) Q_INTERFACES(QQmlParserStatus) Q_CLASSINFO("DefaultProperty", "columns") + QML_NAMED_ELEMENT(TableModel) public: QQmlTableModel(QObject *parent = nullptr); diff --git a/src/qmlmodels/qqmltablemodelcolumn_p.h b/src/qmlmodels/qqmltablemodelcolumn_p.h index 0b6478ce38..33f32ccb68 100644 --- a/src/qmlmodels/qqmltablemodelcolumn_p.h +++ b/src/qmlmodels/qqmltablemodelcolumn_p.h @@ -96,6 +96,7 @@ class Q_QMLMODELS_PRIVATE_EXPORT 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) public: QQmlTableModelColumn(QObject *parent = nullptr); diff --git a/src/qmlmodels/qquickpackage_p.h b/src/qmlmodels/qquickpackage_p.h index 97f7818fee..97f3bab9bc 100644 --- a/src/qmlmodels/qquickpackage_p.h +++ b/src/qmlmodels/qquickpackage_p.h @@ -66,6 +66,9 @@ class Q_AUTOTEST_EXPORT QQuickPackage : public QObject Q_DECLARE_PRIVATE(QQuickPackage) Q_CLASSINFO("DefaultProperty", "data") + QML_NAMED_ELEMENT(Package) + QML_ADDED_IN_MINOR_VERSION(14) + QML_ATTACHED(QQuickPackageAttached) Q_PROPERTY(QQmlListProperty<QObject> data READ data) public: @@ -99,6 +102,5 @@ private: QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickPackage) -QML_DECLARE_TYPEINFO(QQuickPackage, QML_HAS_ATTACHED_PROPERTIES) #endif // QQUICKPACKAGE_H diff --git a/src/qmltest/quicktestevent_p.h b/src/qmltest/quicktestevent_p.h index 5208c03a82..a3c2e78e58 100644 --- a/src/qmltest/quicktestevent_p.h +++ b/src/qmltest/quicktestevent_p.h @@ -54,6 +54,7 @@ #include <QtQuickTest/quicktestglobal.h> #include <QtCore/qobject.h> #include <QtGui/QWindow> +#include <QtQml/qqml.h> #include <QtTest/qtesttouch.h> QT_BEGIN_NAMESPACE @@ -62,6 +63,8 @@ class QuickTestEvent; class Q_QUICK_TEST_EXPORT QQuickTouchEventSequence : public QObject { Q_OBJECT + QML_ANONYMOUS + public: explicit QQuickTouchEventSequence(QuickTestEvent *testEvent, QObject *item = nullptr); public slots: @@ -80,6 +83,7 @@ class Q_QUICK_TEST_EXPORT QuickTestEvent : public QObject { Q_OBJECT Q_PROPERTY(int defaultMouseDelay READ defaultMouseDelay FINAL) + QML_NAMED_ELEMENT(TestEvent) public: QuickTestEvent(QObject *parent = nullptr); ~QuickTestEvent() override; diff --git a/src/qmltest/quicktestresult_p.h b/src/qmltest/quicktestresult_p.h index 0d229ad713..296e8e5344 100644 --- a/src/qmltest/quicktestresult_p.h +++ b/src/qmltest/quicktestresult_p.h @@ -76,6 +76,8 @@ class Q_QUICK_TEST_EXPORT QuickTestResult : public QObject Q_PROPERTY(int skipCount READ skipCount) Q_PROPERTY(QStringList functionsToRun READ functionsToRun) Q_PROPERTY(QStringList tagsToRun READ tagsToRun) + QML_NAMED_ELEMENT(TestResult) + public: QuickTestResult(QObject *parent = nullptr); ~QuickTestResult() override; diff --git a/src/qmlworkerscript/qqmlworkerscriptmodule.cpp b/src/qmlworkerscript/qqmlworkerscriptmodule.cpp index 98e82dbeba..42efe1a8eb 100644 --- a/src/qmlworkerscript/qqmlworkerscriptmodule.cpp +++ b/src/qmlworkerscript/qqmlworkerscriptmodule.cpp @@ -47,6 +47,7 @@ QT_BEGIN_NAMESPACE void QQmlWorkerScriptModule::registerQuickTypes() { // Don't add anything here. These are only for backwards compatibility. + // Also, don't convert to qmlRegisterTypesAndRevisions as that will add future revisions. const char uri[] = "QtQuick"; qmlRegisterType<QQuickWorkerScript>(uri, 2, 0, "WorkerScript"); } @@ -56,7 +57,7 @@ void QQmlWorkerScriptModule::registerQuickTypes() void QQmlWorkerScriptModule::defineModule() { const char uri[] = "QtQml.WorkerScript"; - qmlRegisterType<QQuickWorkerScript>(uri, 2, 0, "WorkerScript"); + qmlRegisterTypesAndRevisions<QQuickWorkerScript>(uri, 2); } QT_END_NAMESPACE diff --git a/src/qmlworkerscript/qquickworkerscript_p.h b/src/qmlworkerscript/qquickworkerscript_p.h index 87cf2e9754..9b5d3587fb 100644 --- a/src/qmlworkerscript/qquickworkerscript_p.h +++ b/src/qmlworkerscript/qquickworkerscript_p.h @@ -87,6 +87,7 @@ class Q_AUTOTEST_EXPORT QQuickWorkerScript : public QObject, public QQmlParserSt { Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) + QML_NAMED_ELEMENT(WorkerScript); Q_INTERFACES(QQmlParserStatus) public: diff --git a/src/quick/handlers/qquickdragaxis_p.h b/src/quick/handlers/qquickdragaxis_p.h index a4649d5eb9..ef74902122 100644 --- a/src/quick/handlers/qquickdragaxis_p.h +++ b/src/quick/handlers/qquickdragaxis_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtQml/qqml.h> #include <private/qtquickglobal_p.h> QT_BEGIN_NAMESPACE @@ -61,6 +62,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickDragAxis : public QObject Q_PROPERTY(qreal minimum READ minimum WRITE setMinimum NOTIFY minimumChanged) Q_PROPERTY(qreal maximum READ maximum WRITE setMaximum NOTIFY maximumChanged) Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) + QML_NAMED_ELEMENT(DragAxis) + QML_ADDED_IN_MINOR_VERSION(12) + QML_UNCREATABLE("DragAxis is only available as a grouped property of DragHandler.") public: QQuickDragAxis(); diff --git a/src/quick/handlers/qquickdraghandler_p.h b/src/quick/handlers/qquickdraghandler_p.h index e8f47163ed..22d51c78ec 100644 --- a/src/quick/handlers/qquickdraghandler_p.h +++ b/src/quick/handlers/qquickdraghandler_p.h @@ -63,6 +63,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickDragHandler : public QQuickMultiPointHandler Q_PROPERTY(QQuickDragAxis * yAxis READ yAxis CONSTANT) Q_PROPERTY(QVector2D translation READ translation NOTIFY translationChanged) Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged REVISION 14) + QML_NAMED_ELEMENT(DragHandler) + QML_ADDED_IN_MINOR_VERSION(12) public: enum SnapMode { diff --git a/src/quick/handlers/qquickhoverhandler_p.h b/src/quick/handlers/qquickhoverhandler_p.h index d8e5fc00a1..e4786bfa53 100644 --- a/src/quick/handlers/qquickhoverhandler_p.h +++ b/src/quick/handlers/qquickhoverhandler_p.h @@ -62,6 +62,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickHoverHandler : public QQuickSinglePointHandle { Q_OBJECT Q_PROPERTY(bool hovered READ isHovered NOTIFY hoveredChanged) + QML_NAMED_ELEMENT(HoverHandler) + QML_ADDED_IN_MINOR_VERSION(12) public: explicit QQuickHoverHandler(QQuickItem *parent = nullptr); diff --git a/src/quick/handlers/qquickpinchhandler_p.h b/src/quick/handlers/qquickpinchhandler_p.h index cea794f0c8..708c836acf 100644 --- a/src/quick/handlers/qquickpinchhandler_p.h +++ b/src/quick/handlers/qquickpinchhandler_p.h @@ -78,6 +78,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPinchHandler : public QQuickMultiPointHandler #endif Q_PROPERTY(QQuickDragAxis * xAxis READ xAxis CONSTANT) Q_PROPERTY(QQuickDragAxis * yAxis READ yAxis CONSTANT) + QML_NAMED_ELEMENT(PinchHandler) + QML_ADDED_IN_MINOR_VERSION(12) public: explicit QQuickPinchHandler(QQuickItem *parent = nullptr); diff --git a/src/quick/handlers/qquickpointerhandler_p.h b/src/quick/handlers/qquickpointerhandler_p.h index 995db9c1dc..34ae9ce2c2 100644 --- a/src/quick/handlers/qquickpointerhandler_p.h +++ b/src/quick/handlers/qquickpointerhandler_p.h @@ -73,6 +73,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerHandler : public QObject, public QQmlP Q_PROPERTY(qreal margin READ margin WRITE setMargin NOTIFY marginChanged) Q_PROPERTY(int dragThreshold READ dragThreshold WRITE setDragThreshold RESET resetDragThreshold NOTIFY dragThresholdChanged REVISION 15) + QML_NAMED_ELEMENT(PointerHandler) + QML_UNCREATABLE("PointerHandler is an abstract base class.") + QML_ADDED_IN_MINOR_VERSION(12) + public: explicit QQuickPointerHandler(QQuickItem *parent = nullptr); ~QQuickPointerHandler(); diff --git a/src/quick/handlers/qquickpointhandler_p.h b/src/quick/handlers/qquickpointhandler_p.h index c197cb4f20..42677540a7 100644 --- a/src/quick/handlers/qquickpointhandler_p.h +++ b/src/quick/handlers/qquickpointhandler_p.h @@ -59,6 +59,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointHandler : public QQuickSinglePointHandle { Q_OBJECT Q_PROPERTY(QVector2D translation READ translation NOTIFY translationChanged) + QML_NAMED_ELEMENT(PointHandler) + QML_ADDED_IN_MINOR_VERSION(12) public: explicit QQuickPointHandler(QQuickItem *parent = nullptr); diff --git a/src/quick/handlers/qquicktaphandler_p.h b/src/quick/handlers/qquicktaphandler_p.h index 56e08590b2..07454bccb8 100644 --- a/src/quick/handlers/qquicktaphandler_p.h +++ b/src/quick/handlers/qquicktaphandler_p.h @@ -67,6 +67,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTapHandler : public QQuickSinglePointHandler Q_PROPERTY(qreal longPressThreshold READ longPressThreshold WRITE setLongPressThreshold NOTIFY longPressThresholdChanged) Q_PROPERTY(GesturePolicy gesturePolicy READ gesturePolicy WRITE setGesturePolicy NOTIFY gesturePolicyChanged) + QML_NAMED_ELEMENT(TapHandler) + QML_ADDED_IN_MINOR_VERSION(12) + public: enum GesturePolicy { DragThreshold, diff --git a/src/quick/handlers/qquickwheelhandler_p.h b/src/quick/handlers/qquickwheelhandler_p.h index f8d1c00726..26b052c5b3 100644 --- a/src/quick/handlers/qquickwheelhandler_p.h +++ b/src/quick/handlers/qquickwheelhandler_p.h @@ -72,6 +72,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickWheelHandler : public QQuickSinglePointHandle Q_PROPERTY(qreal targetScaleMultiplier READ targetScaleMultiplier WRITE setTargetScaleMultiplier NOTIFY targetScaleMultiplierChanged) Q_PROPERTY(bool targetTransformAroundCursor READ isTargetTransformAroundCursor WRITE setTargetTransformAroundCursor NOTIFY targetTransformAroundCursorChanged) + QML_NAMED_ELEMENT(WheelHandler) + QML_ADDED_IN_MINOR_VERSION(14) + public: explicit QQuickWheelHandler(QQuickItem *parent = nullptr); diff --git a/src/quick/items/context2d/qquickcanvasitem_p.h b/src/quick/items/context2d/qquickcanvasitem_p.h index cd2977429b..6575caf806 100644 --- a/src/quick/items/context2d/qquickcanvasitem_p.h +++ b/src/quick/items/context2d/qquickcanvasitem_p.h @@ -99,6 +99,7 @@ class QQuickCanvasItem : public QQuickItem Q_PROPERTY(QRectF canvasWindow READ canvasWindow WRITE setCanvasWindow NOTIFY canvasWindowChanged) Q_PROPERTY(RenderTarget renderTarget READ renderTarget WRITE setRenderTarget NOTIFY renderTargetChanged) Q_PROPERTY(RenderStrategy renderStrategy READ renderStrategy WRITE setRenderStrategy NOTIFY renderStrategyChanged) + QML_NAMED_ELEMENT(Canvas) public: enum RenderTarget { diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h index f4194ef13d..678c1361ba 100644 --- a/src/quick/items/qquickaccessibleattached_p.h +++ b/src/quick/items/qquickaccessibleattached_p.h @@ -90,6 +90,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickAccessibleAttached : public QObject Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged FINAL) Q_PROPERTY(bool ignored READ ignored WRITE setIgnored NOTIFY ignoredChanged FINAL) + QML_NAMED_ELEMENT(Accessible) + QML_UNCREATABLE("Accessible is only available via attached properties.") + QML_ATTACHED(QQuickAccessibleAttached) + public: Q_ENUMS(QAccessible::Role QAccessible::Event) STATE_PROPERTY(checkable) @@ -237,7 +241,6 @@ public: QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickAccessibleAttached) -QML_DECLARE_TYPEINFO(QQuickAccessibleAttached, QML_HAS_ATTACHED_PROPERTIES) #endif // accessibility diff --git a/src/quick/items/qquickanchors_p.h b/src/quick/items/qquickanchors_p.h index c7995cb7a8..e0276549e9 100644 --- a/src/quick/items/qquickanchors_p.h +++ b/src/quick/items/qquickanchors_p.h @@ -84,6 +84,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickAnchors : public QObject Q_PROPERTY(QQuickItem *fill READ fill WRITE setFill RESET resetFill NOTIFY fillChanged) Q_PROPERTY(QQuickItem *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged) Q_PROPERTY(bool alignWhenCentered READ alignWhenCentered WRITE setAlignWhenCentered NOTIFY centerAlignedChanged) + QML_ANONYMOUS public: QQuickAnchors(QQuickItem *item, QObject *parent=nullptr); diff --git a/src/quick/items/qquickanimatedimage_p.h b/src/quick/items/qquickanimatedimage_p.h index ef5af6b387..d18e7c43c7 100644 --- a/src/quick/items/qquickanimatedimage_p.h +++ b/src/quick/items/qquickanimatedimage_p.h @@ -74,6 +74,7 @@ class Q_AUTOTEST_EXPORT QQuickAnimatedImage : public QQuickImage // read-only for AnimatedImage Q_PROPERTY(QSize sourceSize READ sourceSize NOTIFY sourceSizeChanged) + QML_NAMED_ELEMENT(AnimatedImage) public: QQuickAnimatedImage(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickanimatedsprite_p.h b/src/quick/items/qquickanimatedsprite_p.h index ff59591c9f..ff5002334e 100644 --- a/src/quick/items/qquickanimatedsprite_p.h +++ b/src/quick/items/qquickanimatedsprite_p.h @@ -92,6 +92,7 @@ class Q_AUTOTEST_EXPORT QQuickAnimatedSprite : public QQuickItem Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopsChanged) Q_PROPERTY(bool paused READ paused WRITE setPaused NOTIFY pausedChanged) Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY currentFrameChanged) + QML_NAMED_ELEMENT(AnimatedSprite) public: explicit QQuickAnimatedSprite(QQuickItem *parent = nullptr); diff --git a/src/quick/items/qquickborderimage_p.h b/src/quick/items/qquickborderimage_p.h index 61bd26ba83..515edb33da 100644 --- a/src/quick/items/qquickborderimage_p.h +++ b/src/quick/items/qquickborderimage_p.h @@ -67,6 +67,7 @@ class Q_AUTOTEST_EXPORT QQuickBorderImage : public QQuickImageBase Q_PROPERTY(TileMode verticalTileMode READ verticalTileMode WRITE setVerticalTileMode NOTIFY verticalTileModeChanged) // read-only for BorderImage Q_PROPERTY(QSize sourceSize READ sourceSize NOTIFY sourceSizeChanged) + QML_NAMED_ELEMENT(BorderImage) public: QQuickBorderImage(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp index 028b2b153d..4840333923 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -60,6 +60,8 @@ QT_BEGIN_NAMESPACE class QQuickDragAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener { Q_DECLARE_PUBLIC(QQuickDragAttached) + QML_ANONYMOUS + public: static QQuickDragAttachedPrivate *get(QQuickDragAttached *attached) { return static_cast<QQuickDragAttachedPrivate *>(QObjectPrivate::get(attached)); } diff --git a/src/quick/items/qquickdrag_p.h b/src/quick/items/qquickdrag_p.h index 094070aa2c..9dbaac18f9 100644 --- a/src/quick/items/qquickdrag_p.h +++ b/src/quick/items/qquickdrag_p.h @@ -172,6 +172,10 @@ class Q_AUTOTEST_EXPORT QQuickDrag : public QObject Q_PROPERTY(qreal threshold READ threshold WRITE setThreshold NOTIFY thresholdChanged RESET resetThreshold) //### consider drag and drop + QML_NAMED_ELEMENT(Drag) + QML_UNCREATABLE("Drag is only available via attached properties.") + QML_ATTACHED(QQuickDragAttached) + public: QQuickDrag(QObject *parent=nullptr); ~QQuickDrag(); @@ -254,6 +258,9 @@ class QQuickDragAttached : public QObject Q_PROPERTY(Qt::DropActions supportedActions READ supportedActions WRITE setSupportedActions NOTIFY supportedActionsChanged) Q_PROPERTY(Qt::DropAction proposedAction READ proposedAction WRITE setProposedAction NOTIFY proposedActionChanged) Q_PROPERTY(QQuickDrag::DragType dragType READ dragType WRITE setDragType NOTIFY dragTypeChanged) + + QML_ANONYMOUS + public: QQuickDragAttached(QObject *parent); ~QQuickDragAttached(); @@ -316,6 +323,5 @@ Q_SIGNALS: QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickDrag) -QML_DECLARE_TYPEINFO(QQuickDrag, QML_HAS_ATTACHED_PROPERTIES) #endif diff --git a/src/quick/items/qquickdroparea_p.h b/src/quick/items/qquickdroparea_p.h index 2b2ace2eae..ee2deaa97a 100644 --- a/src/quick/items/qquickdroparea_p.h +++ b/src/quick/items/qquickdroparea_p.h @@ -80,6 +80,7 @@ class QQuickDropEvent : public QObject Q_PROPERTY(QString text READ text) Q_PROPERTY(QList<QUrl> urls READ urls) Q_PROPERTY(QStringList formats READ formats) + QML_ANONYMOUS public: QQuickDropEvent(QQuickDropAreaPrivate *d, QDropEvent *event) : d(d), event(event) {} @@ -125,6 +126,7 @@ class QQuickDropAreaDrag : public QObject Q_PROPERTY(qreal x READ x NOTIFY positionChanged) Q_PROPERTY(qreal y READ y NOTIFY positionChanged) Q_PROPERTY(QObject *source READ source NOTIFY sourceChanged) + QML_ANONYMOUS public: QQuickDropAreaDrag(QQuickDropAreaPrivate *d, QObject *parent = 0); ~QQuickDropAreaDrag(); @@ -151,6 +153,7 @@ class Q_AUTOTEST_EXPORT QQuickDropArea : public QQuickItem Q_PROPERTY(bool containsDrag READ containsDrag NOTIFY containsDragChanged) Q_PROPERTY(QStringList keys READ keys WRITE setKeys NOTIFY keysChanged) Q_PROPERTY(QQuickDropAreaDrag *drag READ drag CONSTANT) + QML_NAMED_ELEMENT(DropArea) public: QQuickDropArea(QQuickItem *parent=0); diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h index 1a3737091f..1d2ffefc9d 100644 --- a/src/quick/items/qquickevents_p_p.h +++ b/src/quick/items/qquickevents_p_p.h @@ -84,6 +84,7 @@ class QQuickKeyEvent : public QObject Q_PROPERTY(int count READ count CONSTANT) Q_PROPERTY(quint32 nativeScanCode READ nativeScanCode CONSTANT) Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) + QML_ANONYMOUS public: QQuickKeyEvent() @@ -135,6 +136,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickMouseEvent : public QObject Q_PROPERTY(bool isClick READ isClick CONSTANT) Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) Q_PROPERTY(int flags READ flags CONSTANT REVISION 11) + QML_ANONYMOUS public: QQuickMouseEvent() @@ -201,6 +203,7 @@ class QQuickWheelEvent : public QObject Q_PROPERTY(int modifiers READ modifiers CONSTANT) Q_PROPERTY(bool inverted READ inverted CONSTANT) Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) + QML_ANONYMOUS public: QQuickWheelEvent() @@ -245,6 +248,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickCloseEvent : public QObject { Q_OBJECT Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) + QML_ANONYMOUS public: QQuickCloseEvent() {} @@ -271,6 +275,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickEventPoint : public QObject Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) Q_PROPERTY(QObject *exclusiveGrabber READ exclusiveGrabber WRITE setExclusiveGrabber) + QML_NAMED_ELEMENT(EventPoint) + QML_UNCREATABLE("EventPoint is only available as a member of PointerEvent.") + QML_ADDED_IN_MINOR_VERSION(12) + public: enum State { Pressed = Qt::TouchPointPressed, @@ -362,6 +370,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickEventTouchPoint : public QQuickEventPoint Q_PROPERTY(QSizeF ellipseDiameters READ ellipseDiameters) Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId) + QML_NAMED_ELEMENT(EventTouchPoint) + QML_UNCREATABLE("EventTouchPoint is only available as a member of PointerEvent.") + QML_ADDED_IN_MINOR_VERSION(12) + public: QQuickEventTouchPoint(QQuickPointerTouchEvent *parent); @@ -391,6 +403,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerEvent : public QObject Q_PROPERTY(Qt::MouseButtons button READ button CONSTANT) Q_PROPERTY(Qt::MouseButtons buttons READ buttons CONSTANT) + QML_NAMED_ELEMENT(PointerEvent) + QML_UNCREATABLE("PointerEvent is only available as a parameter of several signals in PointerHandler") + QML_ADDED_IN_MINOR_VERSION(12) + public: QQuickPointerEvent(QObject *parent = nullptr, QQuickPointerDevice *device = nullptr) : QObject(parent) @@ -482,6 +498,11 @@ protected: class Q_QUICK_PRIVATE_EXPORT QQuickPointerMouseEvent : public QQuickSinglePointEvent { Q_OBJECT + + QML_NAMED_ELEMENT(PointerMouseEvent) + QML_UNCREATABLE("PointerMouseEvent is only available as a parameter of several signals in PointerHandler") + QML_ADDED_IN_MINOR_VERSION(12) + public: QQuickPointerMouseEvent(QObject *parent = nullptr, QQuickPointerDevice *device = nullptr) : QQuickSinglePointEvent(parent, device) { } @@ -502,6 +523,11 @@ public: class Q_QUICK_PRIVATE_EXPORT QQuickPointerTouchEvent : public QQuickPointerEvent { Q_OBJECT + + QML_NAMED_ELEMENT(PointerTouchEvent) + QML_UNCREATABLE("PointerTouchEvent is only available as a parameter of several signals in PointerHandler") + QML_ADDED_IN_MINOR_VERSION(12) + public: QQuickPointerTouchEvent(QObject *parent = nullptr, QQuickPointerDevice *device = nullptr) : QQuickPointerEvent(parent, device) @@ -623,6 +649,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerDevice : public QObject Q_PROPERTY(QString name READ name CONSTANT) Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId CONSTANT) + QML_NAMED_ELEMENT(PointerDevice) + QML_UNCREATABLE("PointerDevice is only available as a property of PointerEvent.") + QML_ADDED_IN_MINOR_VERSION(12) + public: enum DeviceType : qint16 { UnknownDevice = 0x0000, diff --git a/src/quick/items/qquickflickable_p.h b/src/quick/items/qquickflickable_p.h index c54ed5ce71..2d8d4a5e9a 100644 --- a/src/quick/items/qquickflickable_p.h +++ b/src/quick/items/qquickflickable_p.h @@ -114,6 +114,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickFlickable : public QQuickItem Q_PROPERTY(QQmlListProperty<QObject> flickableData READ flickableData) Q_PROPERTY(QQmlListProperty<QQuickItem> flickableChildren READ flickableChildren) Q_CLASSINFO("DefaultProperty", "flickableData") + QML_NAMED_ELEMENT(Flickable) public: QQuickFlickable(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h index 835c54170f..1ff55dae90 100644 --- a/src/quick/items/qquickflickable_p_p.h +++ b/src/quick/items/qquickflickable_p_p.h @@ -284,6 +284,7 @@ class QQuickFlickableVisibleArea : public QObject Q_PROPERTY(qreal yPosition READ yPosition NOTIFY yPositionChanged) Q_PROPERTY(qreal widthRatio READ widthRatio NOTIFY widthRatioChanged) Q_PROPERTY(qreal heightRatio READ heightRatio NOTIFY heightRatioChanged) + QML_ANONYMOUS public: QQuickFlickableVisibleArea(QQuickFlickable *parent=nullptr); diff --git a/src/quick/items/qquickflipable_p.h b/src/quick/items/qquickflipable_p.h index d70cd02d35..42c632a33c 100644 --- a/src/quick/items/qquickflipable_p.h +++ b/src/quick/items/qquickflipable_p.h @@ -71,6 +71,7 @@ class Q_AUTOTEST_EXPORT QQuickFlipable : public QQuickItem Q_PROPERTY(QQuickItem *front READ front WRITE setFront NOTIFY frontChanged) Q_PROPERTY(QQuickItem *back READ back WRITE setBack NOTIFY backChanged) Q_PROPERTY(Side side READ side NOTIFY sideChanged) + QML_NAMED_ELEMENT(Flipable) //### flipAxis //### flipRotation public: diff --git a/src/quick/items/qquickfocusscope_p.h b/src/quick/items/qquickfocusscope_p.h index af750fc127..c32fa93cd9 100644 --- a/src/quick/items/qquickfocusscope_p.h +++ b/src/quick/items/qquickfocusscope_p.h @@ -58,6 +58,7 @@ QT_BEGIN_NAMESPACE class Q_AUTOTEST_EXPORT QQuickFocusScope : public QQuickItem { Q_OBJECT + QML_NAMED_ELEMENT(FocusScope) public: QQuickFocusScope(QQuickItem *parent=nullptr); virtual ~QQuickFocusScope(); diff --git a/src/quick/items/qquickgraphicsinfo_p.h b/src/quick/items/qquickgraphicsinfo_p.h index f0a18c29cc..066a419c37 100644 --- a/src/quick/items/qquickgraphicsinfo_p.h +++ b/src/quick/items/qquickgraphicsinfo_p.h @@ -75,6 +75,11 @@ class QQuickGraphicsInfo : public QObject Q_PROPERTY(OpenGLContextProfile profile READ profile NOTIFY profileChanged FINAL) Q_PROPERTY(RenderableType renderableType READ renderableType NOTIFY renderableTypeChanged FINAL) + QML_NAMED_ELEMENT(GraphicsInfo) + QML_ADDED_IN_MINOR_VERSION(8) + QML_UNCREATABLE("GraphicsInfo is only available via attached properties.") + QML_ATTACHED(QQuickGraphicsInfo) + public: enum GraphicsApi { Unknown = QSGRendererInterface::Unknown, @@ -168,6 +173,4 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPEINFO(QQuickGraphicsInfo, QML_HAS_ATTACHED_PROPERTIES) - #endif // QQUICKGRAPHICSINFO_P_H diff --git a/src/quick/items/qquickgridview_p.h b/src/quick/items/qquickgridview_p.h index 7daeaf41a1..9072e5f269 100644 --- a/src/quick/items/qquickgridview_p.h +++ b/src/quick/items/qquickgridview_p.h @@ -73,6 +73,8 @@ class Q_AUTOTEST_EXPORT QQuickGridView : public QQuickItemView Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged) Q_CLASSINFO("DefaultProperty", "data") + QML_NAMED_ELEMENT(GridView) + QML_ATTACHED(QQuickGridViewAttached) public: enum Flow { @@ -136,6 +138,5 @@ public: QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickGridView) -QML_DECLARE_TYPEINFO(QQuickGridView, QML_HAS_ATTACHED_PROPERTIES) #endif // QQUICKGRIDVIEW_P_H diff --git a/src/quick/items/qquickimage_p.h b/src/quick/items/qquickimage_p.h index 257cde5313..f7e652cdcc 100644 --- a/src/quick/items/qquickimage_p.h +++ b/src/quick/items/qquickimage_p.h @@ -68,6 +68,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickImage : public QQuickImageBase Q_PROPERTY(VAlignment verticalAlignment READ verticalAlignment WRITE setVerticalAlignment NOTIFY verticalAlignmentChanged) Q_PROPERTY(bool mipmap READ mipmap WRITE setMipmap NOTIFY mipmapChanged REVISION 3) Q_PROPERTY(bool autoTransform READ autoTransform WRITE setAutoTransform NOTIFY autoTransformChanged REVISION 5) + QML_NAMED_ELEMENT(Image) public: QQuickImage(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickimagebase_p.h b/src/quick/items/qquickimagebase_p.h index 8cd59c8cea..d1d01ad27d 100644 --- a/src/quick/items/qquickimagebase_p.h +++ b/src/quick/items/qquickimagebase_p.h @@ -71,6 +71,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickImageBase : public QQuickImplicitSizeItem Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY currentFrameChanged REVISION 14) Q_PROPERTY(int frameCount READ frameCount NOTIFY frameCountChanged REVISION 14) + QML_NAMED_ELEMENT(ImageBase); + QML_ADDED_IN_MINOR_VERSION(14) + QML_UNCREATABLE("ImageBase is an abstract base class.") + public: QQuickImageBase(QQuickItem *parent=nullptr); ~QQuickImageBase(); diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index 394a5adb8c..8c04ced11b 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -58,6 +58,7 @@ class QQuickTransformPrivate; class Q_QUICK_EXPORT QQuickTransform : public QObject { Q_OBJECT + QML_ANONYMOUS public: explicit QQuickTransform(QObject *parent = nullptr); ~QQuickTransform() override; @@ -150,6 +151,7 @@ class Q_QUICK_EXPORT QQuickItem : public QObject, public QQmlParserStatus Q_CLASSINFO("DefaultProperty", "data") Q_CLASSINFO("qt_QmlJSWrapperFactoryMethod", "_q_createJSWrapper(QV4::ExecutionEngine*)") + QML_NAMED_ELEMENT(Item) public: enum Flag { diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index 3e8feec4bf..7c3325fd90 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -152,6 +152,7 @@ class QQuickItemLayer : public QObject, public QQuickItemChangeListener Q_PROPERTY(QQmlComponent *effect READ effect WRITE setEffect NOTIFY effectChanged) Q_PROPERTY(QQuickShaderEffectSource::TextureMirroring textureMirroring READ textureMirroring WRITE setTextureMirroring NOTIFY textureMirroringChanged) Q_PROPERTY(int samples READ samples WRITE setSamples NOTIFY samplesChanged) + QML_ANONYMOUS public: QQuickItemLayer(QQuickItem *item); @@ -715,6 +716,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickKeyNavigationAttached : public QObject, publi Q_PROPERTY(QQuickItem *backtab READ backtab WRITE setBacktab NOTIFY backtabChanged) Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged) + QML_NAMED_ELEMENT(KeyNavigation) + QML_UNCREATABLE("KeyNavigation is only available via attached properties.") + QML_ATTACHED(QQuickKeyNavigationAttached) + public: QQuickKeyNavigationAttached(QObject * = nullptr); @@ -760,6 +765,10 @@ class QQuickLayoutMirroringAttached : public QObject Q_PROPERTY(bool enabled READ enabled WRITE setEnabled RESET resetEnabled NOTIFY enabledChanged) Q_PROPERTY(bool childrenInherit READ childrenInherit WRITE setChildrenInherit NOTIFY childrenInheritChanged) + QML_NAMED_ELEMENT(LayoutMirroring) + QML_UNCREATABLE("LayoutMirroring is only available via attached properties.") + QML_ATTACHED(QQuickLayoutMirroringAttached) + public: explicit QQuickLayoutMirroringAttached(QObject *parent = nullptr); @@ -784,6 +793,11 @@ class QQuickEnterKeyAttached : public QObject Q_OBJECT Q_PROPERTY(Qt::EnterKeyType type READ type WRITE setType NOTIFY typeChanged) + QML_NAMED_ELEMENT(EnterKey) + QML_UNCREATABLE("EnterKey is only available via attached properties") + QML_ADDED_IN_MINOR_VERSION(6) + QML_ATTACHED(QQuickEnterKeyAttached) + public: explicit QQuickEnterKeyAttached(QObject *parent = nullptr); @@ -829,6 +843,10 @@ class QQuickKeysAttached : public QObject, public QQuickItemKeyFilter Q_PROPERTY(QQmlListProperty<QQuickItem> forwardTo READ forwardTo) Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged) + QML_NAMED_ELEMENT(Keys) + QML_UNCREATABLE("Keys is only available via attached properties") + QML_ATTACHED(QQuickKeysAttached) + public: QQuickKeysAttached(QObject *parent=nullptr); ~QQuickKeysAttached() override; @@ -984,12 +1002,8 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickItemLayer) #endif QML_DECLARE_TYPE(QQuickKeysAttached) -QML_DECLARE_TYPEINFO(QQuickKeysAttached, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QQuickKeyNavigationAttached) -QML_DECLARE_TYPEINFO(QQuickKeyNavigationAttached, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QQuickLayoutMirroringAttached) -QML_DECLARE_TYPEINFO(QQuickLayoutMirroringAttached, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QQuickEnterKeyAttached) -QML_DECLARE_TYPEINFO(QQuickEnterKeyAttached, QML_HAS_ATTACHED_PROPERTIES) #endif // QQUICKITEM_P_H diff --git a/src/quick/items/qquickitemanimation_p.h b/src/quick/items/qquickitemanimation_p.h index b803455f12..28c18c874d 100644 --- a/src/quick/items/qquickitemanimation_p.h +++ b/src/quick/items/qquickitemanimation_p.h @@ -66,6 +66,7 @@ class Q_AUTOTEST_EXPORT QQuickParentAnimation : public QQuickAnimationGroup Q_PROPERTY(QQuickItem *target READ target WRITE setTargetObject NOTIFY targetChanged) Q_PROPERTY(QQuickItem *newParent READ newParent WRITE setNewParent NOTIFY newParentChanged) Q_PROPERTY(QQuickItem *via READ via WRITE setVia NOTIFY viaChanged) + QML_NAMED_ELEMENT(ParentAnimation) public: QQuickParentAnimation(QObject *parent=nullptr); @@ -100,6 +101,7 @@ class Q_AUTOTEST_EXPORT QQuickAnchorAnimation : public QQuickAbstractAnimation Q_PROPERTY(QQmlListProperty<QQuickItem> targets READ targets) Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged) + QML_NAMED_ELEMENT(AnchorAnimation) public: QQuickAnchorAnimation(QObject *parent=nullptr); @@ -143,6 +145,7 @@ class Q_AUTOTEST_EXPORT QQuickPathAnimation : public QQuickAbstractAnimation Q_PROPERTY(int orientationEntryDuration READ orientationEntryDuration WRITE setOrientationEntryDuration NOTIFY orientationEntryDurationChanged) Q_PROPERTY(int orientationExitDuration READ orientationExitDuration WRITE setOrientationExitDuration NOTIFY orientationExitDurationChanged) Q_PROPERTY(qreal endRotation READ endRotation WRITE setEndRotation NOTIFY endRotationChanged) + QML_NAMED_ELEMENT(PathAnimation) public: QQuickPathAnimation(QObject *parent=nullptr); diff --git a/src/quick/items/qquickitemgrabresult.h b/src/quick/items/qquickitemgrabresult.h index 3dc10e2d75..c92a8c52f4 100644 --- a/src/quick/items/qquickitemgrabresult.h +++ b/src/quick/items/qquickitemgrabresult.h @@ -45,6 +45,7 @@ #include <QtCore/QUrl> #include <QtGui/QImage> #include <QtQml/QJSValue> +#include <QtQml/qqml.h> #include <QtQuick/qtquickglobal.h> QT_BEGIN_NAMESPACE @@ -60,6 +61,8 @@ class Q_QUICK_EXPORT QQuickItemGrabResult : public QObject Q_PROPERTY(QImage image READ image CONSTANT) Q_PROPERTY(QUrl url READ url CONSTANT) + QML_ANONYMOUS + public: QImage image() const; QUrl url() const; diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index fbfb7521ea..dd4e4dfdc0 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -175,331 +175,218 @@ static QQmlPrivate::AutoParentResult qquickitem_autoParent(QObject *obj, QObject return QQmlPrivate::IncompatibleObject; } -static void qt_quickitems_defineModule(const char *uri, int major, int minor) +static void qt_quickitems_defineModule() { + const char *uri = "QtQuick"; + const int major = 2; + QQmlPrivate::RegisterAutoParent autoparent = { 0, &qquickitem_autoParent }; QQmlPrivate::qmlregister(QQmlPrivate::AutoParentRegistration, &autoparent); - // Register the latest version, even if there are no new types or new revisions for existing types yet. - qmlRegisterModule(uri, 2, QT_VERSION_MINOR); - -#if !QT_CONFIG(quick_animatedimage) - qmlRegisterTypeNotAvailable(uri,major,minor,"AnimatedImage", QCoreApplication::translate("QQuickAnimatedImage","Qt was built without support for QMovie")); -#else - qmlRegisterType<QQuickAnimatedImage>(uri,major,minor,"AnimatedImage"); -#endif - qmlRegisterType<QQuickBorderImage>(uri,major,minor,"BorderImage"); - qmlRegisterType<QQuickFlickable>(uri,major,minor,"Flickable"); -#if QT_CONFIG(quick_flipable) - qmlRegisterType<QQuickFlipable>(uri,major,minor,"Flipable"); -#endif -// qmlRegisterType<QQuickFocusPanel>(uri,major,minor,"FocusPanel"); - qmlRegisterType<QQuickFocusScope>(uri,major,minor,"FocusScope"); - qmlRegisterType<QQuickGradient>(uri,major,minor,"Gradient"); - qmlRegisterType<QQuickGradientStop>(uri,major,minor,"GradientStop"); -#if QT_CONFIG(quick_positioners) - qmlRegisterType<QQuickColumn>(uri,major,minor,"Column"); - qmlRegisterType<QQuickFlow>(uri,major,minor,"Flow"); - qmlRegisterType<QQuickGrid>(uri,major,minor,"Grid"); - qmlRegisterUncreatableType<QQuickBasePositioner>(uri,major,minor,"Positioner", - QStringLiteral("Positioner is an abstract type that is only available as an attached property.")); - qmlRegisterType<QQuickRow>(uri,major,minor,"Row"); -#endif -#if QT_CONFIG(quick_gridview) - qmlRegisterType<QQuickGridView>(uri,major,minor,"GridView"); -#endif - qmlRegisterType<QQuickImage>(uri,major,minor,"Image"); - qmlRegisterType<QQuickItem>(uri,major,minor,"Item"); -#if QT_CONFIG(quick_listview) - qmlRegisterType<QQuickListView>(uri,major,minor,"ListView"); - qmlRegisterType<QQuickViewSection>(uri,major,minor,"ViewSection"); -#endif - qmlRegisterType<QQuickLoader>(uri,major,minor,"Loader"); - qmlRegisterType<QQuickMouseArea>(uri,major,minor,"MouseArea"); -#if QT_CONFIG(quick_path) - qmlRegisterType<QQuickPath>(uri,major,minor,"Path"); - qmlRegisterType<QQuickPathAttribute>(uri,major,minor,"PathAttribute"); - qmlRegisterType<QQuickPathCubic>(uri,major,minor,"PathCubic"); - qmlRegisterType<QQuickPathLine>(uri,major,minor,"PathLine"); - qmlRegisterType<QQuickPathPercent>(uri,major,minor,"PathPercent"); - qmlRegisterType<QQuickPathQuad>(uri,major,minor,"PathQuad"); - qmlRegisterType<QQuickPathCatmullRomCurve>("QtQuick",2,0,"PathCurve"); - qmlRegisterType<QQuickPathArc>("QtQuick",2,0,"PathArc"); - qmlRegisterType<QQuickPathSvg>("QtQuick",2,0,"PathSvg"); - qmlRegisterType<QQuickPath, 14>(uri, 2, 14, "Path"); - qmlRegisterType<QQuickPathPolyline>("QtQuick", 2, 14, "PathPolyline"); - qmlRegisterType<QQuickPathMultiline>("QtQuick", 2, 14, "PathMultiline"); -#endif -#if QT_CONFIG(quick_pathview) - qmlRegisterType<QQuickPathView>(uri,major,minor,"PathView"); -#endif - qmlRegisterType<QQuickRectangle>(uri,major,minor,"Rectangle"); -#if QT_CONFIG(quick_repeater) - qmlRegisterType<QQuickRepeater>(uri,major,minor,"Repeater"); -#endif - qmlRegisterType<QQuickTranslate>(uri,major,minor,"Translate"); - qmlRegisterType<QQuickRotation>(uri,major,minor,"Rotation"); - qmlRegisterType<QQuickScale>(uri,major,minor,"Scale"); - qmlRegisterType<QQuickMatrix4x4>(uri,2,3,"Matrix4x4"); - qmlRegisterType<QQuickText>(uri,major,minor,"Text"); - qmlRegisterType<QQuickTextEdit>(uri,major,minor,"TextEdit"); - qmlRegisterType<QQuickTextEdit,1>(uri,2,1,"TextEdit"); - qmlRegisterType<QQuickTextInput>(uri,major,minor,"TextInput"); - qmlRegisterType<QQuickTextInput,2>(uri,2,2,"TextInput"); - qmlRegisterType<QQuickTextInput,4>(uri,2,4,"TextInput"); - qmlRegisterAnonymousType<QQuickItemGrabResult>(uri, major); -#if QT_CONFIG(quick_shadereffect) - qmlRegisterAnonymousType<QQuickItemLayer>(uri, major); -#endif - qmlRegisterAnonymousType<QQuickAnchors>(uri, major); - qmlRegisterAnonymousType<QQuickKeyEvent>(uri, major); - qmlRegisterAnonymousType<QQuickMouseEvent>(uri, major); - qmlRegisterAnonymousType<QQuickWheelEvent>(uri, major); - qmlRegisterAnonymousType<QQuickCloseEvent>(uri, major); - qmlRegisterAnonymousType<QQuickTransform>(uri, major); -#if QT_CONFIG(quick_path) - qmlRegisterAnonymousType<QQuickPathElement>(uri, major); - qmlRegisterAnonymousType<QQuickCurve>(uri, major); -#endif - qmlRegisterAnonymousType<QQuickScaleGrid>(uri, major); - qmlRegisterAnonymousType<QQuickTextLine>(uri, major); - qmlRegisterAnonymousType<QQuickPen>(uri, major); - qmlRegisterAnonymousType<QQuickFlickableVisibleArea>(uri, major); qRegisterMetaType<QQuickAnchorLine>("QQuickAnchorLine"); + qRegisterMetaType<QPointingDeviceUniqueId>("QPointingDeviceUniqueId"); + qRegisterMetaType<QQuickHandlerPoint>(); - qmlRegisterAnonymousType<QQuickTextDocument>(uri, major); - - - qmlRegisterUncreatableType<QQuickKeyNavigationAttached>(uri,major,minor,"KeyNavigation",QQuickKeyNavigationAttached::tr("KeyNavigation is only available via attached properties")); - qmlRegisterUncreatableType<QQuickKeysAttached>(uri,major,minor,"Keys",QQuickKeysAttached::tr("Keys is only available via attached properties")); - qmlRegisterUncreatableType<QQuickLayoutMirroringAttached>(uri,major,minor,"LayoutMirroring", QQuickLayoutMirroringAttached::tr("LayoutMirroring is only available via attached properties")); -#if QT_CONFIG(quick_viewtransitions) - qmlRegisterUncreatableType<QQuickViewTransitionAttached>(uri,major,minor,"ViewTransition",QQuickViewTransitionAttached::tr("ViewTransition is only available via attached properties")); -#endif + // Register the latest version, even if there are no new types or new revisions for existing types yet. + qmlRegisterModule(uri, major, QT_VERSION_MINOR); + + // Core QtQuick types + qmlRegisterTypesAndRevisions< + QPointingDeviceUniqueIdForeign, + QQuickAnchorAnimation, + QQuickAnchorChanges, + QQuickAnchors, + QQuickAnchorSet, + QQuickBorderImage, + QQuickEnterKeyAttached, + QQuickEventPoint, + QQuickEventTouchPoint, + QQuickFlickable, + QQuickFlickableVisibleArea, + QQuickFocusScope, + QQuickGradient, + QQuickGradientStop, + QQuickGraphicsInfo, + QQuickImage, + QQuickImageBase, + QQuickItem, + QQuickItemGrabResult, + QQuickKeyNavigationAttached, + QQuickKeysAttached, + QQuickLayoutMirroringAttached, + QQuickLoader, + QQuickMatrix4x4, + QQuickMouseArea, + QQuickMultiPointTouchArea, + QQuickPaintedItem, + QQuickParentAnimation, + QQuickParentChange, + QQuickPen, + QQuickPinch, + QQuickPinchArea, + QQuickPointerDevice, + QQuickRectangle, + QQuickRotation, + QQuickScale, + QQuickScaleGrid, + QQuickTouchPoint, + QQuickTransform, + QQuickTranslate + >(uri, major); + + // text-related types + qmlRegisterTypesAndRevisions< + QQuickText, + QQuickTextDocument, + QQuickTextEdit, + QQuickTextInput, + QQuickTextLine + >(uri, major); + + // events + qmlRegisterTypesAndRevisions< + QQuickCloseEvent, + QQuickDropEvent, + QQuickGrabGestureEvent, + QQuickKeyEvent, + QQuickMouseEvent, + QQuickPinchEvent, + QQuickPointerEvent, + QQuickPointerMouseEvent, + QQuickPointerTouchEvent, + QQuickWheelEvent + >(uri, major); - qmlRegisterType<QQuickPinchArea>(uri,major,minor,"PinchArea"); - qmlRegisterType<QQuickPinch>(uri,major,minor,"Pinch"); - qmlRegisterAnonymousType<QQuickPinchEvent>(uri, major); + // Input Handlers are part of QtQuick, not a separate module, since 5.12 + qmlRegisterTypesAndRevisions< + QQuickDragHandler, + QQuickHoverHandler, + QQuickPinchHandler, + QQuickPointerHandler, + QQuickPointHandler, + QQuickTapHandler + >(uri, major); -#if QT_CONFIG(quick_shadereffect) - qmlRegisterType<QQuickShaderEffectSource>("QtQuick", 2, 0, "ShaderEffectSource"); - qmlRegisterUncreatableType<QQuickShaderEffectMesh>("QtQuick", 2, 0, "ShaderEffectMesh", QQuickShaderEffectMesh::tr("Cannot create instance of abstract class ShaderEffectMesh.")); - qmlRegisterType<QQuickGridMesh>("QtQuick", 2, 0, "GridMesh"); - qmlRegisterType<QQuickShaderEffect>("QtQuick", 2, 0, "ShaderEffect"); +#if QT_CONFIG(accessibility) + qmlRegisterTypesAndRevisions<QQuickAccessibleAttached>(uri, major); #endif - qmlRegisterUncreatableType<QQuickPaintedItem>("QtQuick", 2, 0, "PaintedItem", QQuickPaintedItem::tr("Cannot create instance of abstract class PaintedItem")); - -#if QT_CONFIG(quick_canvas) - qmlRegisterType<QQuickCanvasItem>("QtQuick", 2, 0, "Canvas"); +#if QT_CONFIG(opengl) + qmlRegisterTypesAndRevisions<QQuickOpenGLInfo>(uri, major); #endif -#if QT_CONFIG(quick_sprite) - qmlRegisterType<QQuickSprite>("QtQuick", 2, 0, "Sprite"); - qmlRegisterType<QQuickAnimatedSprite>("QtQuick", 2, 0, "AnimatedSprite"); - qmlRegisterType<QQuickSpriteSequence>("QtQuick", 2, 0, "SpriteSequence"); +#if QT_CONFIG(quick_animatedimage) + qmlRegisterTypesAndRevisions<QQuickAnimatedImage>(uri, major); +#else + qmlRegisterTypeNotAvailable( + uri, major, minor, "AnimatedImage", + QCoreApplication::translate("QQuickAnimatedImage", + "Qt was built without support for QMovie")); #endif - qmlRegisterType<QQuickParentChange>(uri, major, minor,"ParentChange"); - qmlRegisterType<QQuickAnchorChanges>(uri, major, minor,"AnchorChanges"); - qmlRegisterAnonymousType<QQuickAnchorSet>(uri, major); - qmlRegisterType<QQuickAnchorAnimation>(uri, major, minor,"AnchorAnimation"); - qmlRegisterType<QQuickParentAnimation>(uri, major, minor,"ParentAnimation"); -#if QT_CONFIG(quick_path) - qmlRegisterType<QQuickPathAnimation>("QtQuick",2,0,"PathAnimation"); - qmlRegisterType<QQuickPathInterpolator>("QtQuick",2,0,"PathInterpolator"); +#if QT_CONFIG(quick_canvas) + qmlRegisterTypesAndRevisions<QQuickCanvasItem>(uri, major); #endif #if QT_CONFIG(quick_draganddrop) - qmlRegisterType<QQuickDropArea>("QtQuick", 2, 0, "DropArea"); - qmlRegisterAnonymousType<QQuickDropEvent>(uri, 2); - qmlRegisterAnonymousType<QQuickDropAreaDrag>(uri, 2); - qmlRegisterUncreatableType<QQuickDrag>("QtQuick", 2, 0, "Drag", QQuickDragAttached::tr("Drag is only available via attached properties")); + qmlRegisterTypesAndRevisions< + QQuickDrag, + QQuickDropArea, + QQuickDropAreaDrag, + QQuickDragAttached, + QQuickDragAxis + >(uri, major); #endif - qmlRegisterType<QQuickMultiPointTouchArea>("QtQuick", 2, 0, "MultiPointTouchArea"); - qmlRegisterType<QQuickTouchPoint>("QtQuick", 2, 0, "TouchPoint"); - qmlRegisterUncreatableType<QQuickGrabGestureEvent>(uri,major,minor, "GestureEvent", - QQuickMouseEvent::tr("GestureEvent is only available in the context of handling the gestureStarted signal from MultiPointTouchArea")); - -#if QT_CONFIG(accessibility) - qmlRegisterUncreatableType<QQuickAccessibleAttached>("QtQuick", 2, 0, "Accessible",QQuickAccessibleAttached::tr("Accessible is only available via attached properties")); +#if QT_CONFIG(quick_flipable) + qmlRegisterTypesAndRevisions<QQuickFlipable>(uri, major); #endif - qmlRegisterType<QQuickItem, 1>(uri, 2, 1,"Item"); #if QT_CONFIG(quick_positioners) - qmlRegisterType<QQuickGrid, 1>(uri, 2, 1, "Grid"); -#endif -#if QT_CONFIG(quick_itemview) - const char *itemViewName = "ItemView"; - const QString itemViewMessage = QQuickItemView::tr("ItemView is an abstract base class"); - qmlRegisterUncreatableType<QQuickItemView, 1>(uri, 2, 1, itemViewName, itemViewMessage); - qmlRegisterUncreatableType<QQuickItemView, 3>(uri, 2, 3, itemViewName, itemViewMessage); -#endif -#if QT_CONFIG(quick_listview) - qmlRegisterType<QQuickListView, 1>(uri, 2, 1, "ListView"); -#endif -#if QT_CONFIG(quick_gridview) - qmlRegisterType<QQuickGridView, 1>(uri, 2, 1, "GridView"); + qmlRegisterTypesAndRevisions< + QQuickBasePositioner, + QQuickColumn, + QQuickFlow, + QQuickGrid, + QQuickRow + >(uri, major); #endif - qmlRegisterType<QQuickTextEdit, 1>(uri, 2, 1, "TextEdit"); - qmlRegisterType<QQuickText, 2>(uri, 2, 2, "Text"); - qmlRegisterType<QQuickTextEdit, 2>(uri, 2, 2, "TextEdit"); - - qmlRegisterType<QQuickText, 3>(uri, 2, 3, "Text"); - qmlRegisterType<QQuickTextEdit, 3>(uri, 2, 3, "TextEdit"); - qmlRegisterType<QQuickImage, 3>(uri, 2, 3,"Image"); - - qmlRegisterType<QQuickItem, 4>(uri, 2, 4, "Item"); -#if QT_CONFIG(quick_listview) - qmlRegisterType<QQuickListView, 4>(uri, 2, 4, "ListView"); -#endif - qmlRegisterType<QQuickMouseArea, 4>(uri, 2, 4, "MouseArea"); -#if QT_CONFIG(quick_shadereffect) - qmlRegisterType<QQuickShaderEffect, 4>(uri, 2, 4, "ShaderEffect"); -#endif - -#if QT_CONFIG(opengl) - qmlRegisterUncreatableType<QQuickOpenGLInfo>(uri, 2, 4,"OpenGLInfo", QQuickOpenGLInfo::tr("OpenGLInfo is only available via attached properties")); +#if QT_CONFIG(quick_gridview) + qmlRegisterTypesAndRevisions<QQuickGridView>(uri, major); #endif - qmlRegisterType<QQuickPinchArea, 5>(uri, 2, 5,"PinchArea"); - qmlRegisterType<QQuickImage, 5>(uri, 2, 5,"Image"); - qmlRegisterType<QQuickMouseArea, 5>(uri, 2, 5, "MouseArea"); - qmlRegisterType<QQuickText, 6>(uri, 2, 6, "Text"); - qmlRegisterType<QQuickTextEdit, 6>(uri, 2, 6, "TextEdit"); - qmlRegisterType<QQuickTextInput, 6>(uri, 2, 6, "TextInput"); -#if QT_CONFIG(quick_positioners) - qmlRegisterUncreatableType<QQuickBasePositioner, 6>(uri, 2, 6, "Positioner", - QStringLiteral("Positioner is an abstract type that is only available as an attached property.")); - qmlRegisterType<QQuickColumn, 6>(uri, 2, 6, "Column"); - qmlRegisterType<QQuickRow, 6>(uri, 2, 6, "Row"); - qmlRegisterType<QQuickGrid, 6>(uri, 2, 6, "Grid"); - qmlRegisterType<QQuickFlow, 6>(uri, 2, 6, "Flow"); -#endif - qmlRegisterUncreatableType<QQuickEnterKeyAttached, 6>(uri, 2, 6, "EnterKey", - QQuickEnterKeyAttached::tr("EnterKey is only available via attached properties")); -#if QT_CONFIG(quick_shadereffect) - qmlRegisterType<QQuickShaderEffectSource, 6>(uri, 2, 6, "ShaderEffectSource"); +#if QT_CONFIG(quick_itemview) + qmlRegisterTypesAndRevisions<QQuickItemView>(uri, major); #endif - qmlRegisterType<QQuickItem, 7>(uri, 2, 7, "Item"); #if QT_CONFIG(quick_listview) - qmlRegisterType<QQuickListView, 7>(uri, 2, 7, "ListView"); -#endif -#if QT_CONFIG(quick_gridview) - qmlRegisterType<QQuickGridView, 7>(uri, 2, 7, "GridView"); -#endif - qmlRegisterType<QQuickTextInput, 7>(uri, 2, 7, "TextInput"); - qmlRegisterType<QQuickTextEdit, 7>(uri, 2, 7, "TextEdit"); -#if QT_CONFIG(quick_pathview) - qmlRegisterType<QQuickPathView, 7>(uri, 2, 7, "PathView"); -#endif -#if QT_CONFIG(quick_itemview) - qmlRegisterUncreatableType<QQuickItemView, 7>(uri, 2, 7, itemViewName, itemViewMessage); + qmlRegisterTypesAndRevisions< + QQuickViewSection, + QQuickListView + >(uri, major); #endif - qmlRegisterUncreatableType<QQuickMouseEvent, 7>(uri, 2, 7, nullptr, QQuickMouseEvent::tr("MouseEvent is only available within handlers in MouseArea")); - - qmlRegisterUncreatableType<QQuickGraphicsInfo>(uri, 2, 8,"GraphicsInfo", QQuickGraphicsInfo::tr("GraphicsInfo is only available via attached properties")); -#if QT_CONFIG(quick_shadereffect) - qmlRegisterType<QQuickBorderImageMesh>("QtQuick", 2, 8, "BorderImageMesh"); +#if QT_CONFIG(quick_path) + qmlRegisterTypesAndRevisions< + QQuickCurve, + QQuickPath, + QQuickPathAngleArc, + QQuickPathAnimation, + QQuickPathArc, + QQuickPathAttribute, + QQuickPathCatmullRomCurve, + QQuickPathCubic, + QQuickPathElement, + QQuickPathInterpolator, + QQuickPathLine, + QQuickPathMove, + QQuickPathMultiline, + QQuickPathPercent, + QQuickPathPolyline, + QQuickPathQuad, + QQuickPathSvg + >(uri, major); #endif - qmlRegisterType<QQuickFlickable, 9>(uri, 2, 9, "Flickable"); - qmlRegisterType<QQuickMouseArea, 9>(uri, 2, 9, "MouseArea"); - -#if QT_CONFIG(quick_path) - qmlRegisterType<QQuickPathArc, 9>(uri, 2, 9, "PathArc"); - qmlRegisterType<QQuickPathMove>(uri, 2, 9, "PathMove"); +#if QT_CONFIG(quick_pathview) + qmlRegisterTypesAndRevisions<QQuickPathView>(uri, major); #endif - qmlRegisterType<QQuickText, 9>(uri, 2, 9, "Text"); - qmlRegisterType<QQuickTextInput, 9>(uri, 2, 9, "TextInput"); - qmlRegisterType<QQuickTouchPoint>(uri, 2, 9, "TouchPoint"); - qRegisterMetaType<QPointingDeviceUniqueId>("QPointingDeviceUniqueId"); - qmlRegisterUncreatableType<QPointingDeviceUniqueId>(uri, 2, 9, "PointingDeviceUniqueId", QQuickTouchPoint::tr("PointingDeviceUniqueId is only available via read-only properties")); -#if QT_CONFIG(quick_positioners) - qmlRegisterUncreatableType<QQuickBasePositioner, 9>(uri, 2, 9, "Positioner", - QStringLiteral("Positioner is an abstract type that is only available as an attached property.")); +#if QT_CONFIG(quick_repeater) + qmlRegisterTypesAndRevisions<QQuickRepeater>(uri, major); #endif #if QT_CONFIG(quick_shadereffect) - qmlRegisterType<QQuickShaderEffectSource, 9>(uri, 2, 9, "ShaderEffectSource"); + qmlRegisterTypesAndRevisions< + QQuickBorderImageMesh, + QQuickGridMesh, + QQuickItemLayer, + QQuickShaderEffect, + QQuickShaderEffectMesh, + QQuickShaderEffectSource + >(uri, major); #endif - qmlRegisterType<QQuickFlickable, 10>(uri, 2, 10, "Flickable"); - qmlRegisterType<QQuickTextEdit, 10>(uri, 2, 10, "TextEdit"); - qmlRegisterType<QQuickText, 10>(uri, 2, 10, "Text"); - -#if QT_CONFIG(quick_path) - qmlRegisterType<QQuickPathAngleArc>(uri, 2, 11, "PathAngleArc"); +#if QT_CONFIG(quick_sprite) + qmlRegisterTypesAndRevisions< + QQuickAnimatedSprite, + QQuickSprite, + QQuickSpriteSequence + >(uri, major); #endif -#if QT_CONFIG(quick_animatedimage) - qmlRegisterType<QQuickAnimatedImage, 11>(uri, 2, 11,"AnimatedImage"); -#endif - qmlRegisterType<QQuickItem, 11>(uri, 2, 11,"Item"); - qmlRegisterType<QQuickFlickable, 12>(uri, 2, 12, "Flickable"); - - // classes related to Input Handlers which are newly exposed since 5.12 - qmlRegisterUncreatableType<QQuickPointerEvent>(uri, 2, 12, "PointerEvent", - QQuickPointerHandler::tr("PointerEvent is only available as a parameter of several signals in PointerHandler")); - qmlRegisterUncreatableType<QQuickPointerMouseEvent>(uri, 2, 12, "PointerMouseEvent", - QQuickPointerHandler::tr("PointerMouseEvent is only available as a parameter of several signals in PointerHandler")); - qmlRegisterUncreatableType<QQuickPointerTouchEvent>(uri, 2, 12, "PointerTouchEvent", - QQuickPointerHandler::tr("PointerTouchEvent is only available as a parameter of several signals in PointerHandler")); - qmlRegisterUncreatableType<QQuickEventPoint>(uri, 2, 12, "EventPoint", - QQuickPointerHandler::tr("EventPoint is only available as a member of PointerEvent")); - qmlRegisterUncreatableType<QQuickEventTouchPoint>(uri, 2, 12, "EventTouchPoint", - QQuickPointerHandler::tr("EventTouchPoint is only available as a member of PointerEvent")); - qmlRegisterUncreatableType<QQuickPointerDevice>(uri, 2, 12, "PointerDevice", - QQuickPointerHandler::tr("PointerDevice is only available as a property of PointerEvent")); - - // Input Handlers are part of QtQuick, not a separate module, since 5.12 - qmlRegisterUncreatableType<QQuickPointerHandler>(uri, 2, 12, "PointerHandler", - QQuickPointerHandler::tr("PointerHandler is an abstract base class")); - qmlRegisterType<QQuickPointHandler>(uri, 2, 12, "PointHandler"); - qmlRegisterType<QQuickDragHandler>(uri, 2, 12, "DragHandler"); - qmlRegisterUncreatableType<QQuickDragAxis>(uri, 2, 12, "DragAxis", - QQuickDragHandler::tr("DragAxis is only available as a grouped property of DragHandler")); - qmlRegisterType<QQuickHoverHandler>(uri, 2, 12, "HoverHandler"); - qmlRegisterType<QQuickPinchHandler>(uri, 2, 12, "PinchHandler"); - qmlRegisterType<QQuickTapHandler>(uri, 2, 12, "TapHandler"); - qRegisterMetaType<QQuickHandlerPoint>(); - - // The rest of the 5.12 revisions - qmlRegisterType<QQuickAnimatedSprite, 12>("QtQuick", 2, 12, "AnimatedSprite"); - qmlRegisterType<QQuickGradient, 12>(uri, 2, 12, "Gradient"); - qmlRegisterType<QQuickFlickable, 12>(uri, 2, 12, "Flickable"); - qmlRegisterType<QQuickText, 12>(uri, 2, 12, "Text"); #if QT_CONFIG(quick_tableview) - qmlRegisterType<QQuickTableView>(uri, 2, 12, "TableView"); + qmlRegisterTypesAndRevisions<QQuickTableView>(uri, major); #endif -#if QT_CONFIG(quick_itemview) - qmlRegisterUncreatableType<QQuickItemView, 13>(uri, 2, 13, itemViewName, itemViewMessage); -#endif -#if QT_CONFIG(quick_pathview) - qmlRegisterType<QQuickPathView, 13>(uri, 2, 13, "PathView"); -#endif -#if QT_CONFIG(quick_gridview) - qmlRegisterType<QQuickGridView, 13>(uri, 2, 13, "GridView"); -#endif -#if QT_CONFIG(quick_tableview) - qmlRegisterType<QQuickTableView, 14>(uri, 2, 14, "TableView"); +#if QT_CONFIG(quick_viewtransitions) + qmlRegisterTypesAndRevisions<QQuickViewTransitionAttached>(uri, major); #endif + #if QT_CONFIG(wheelevent) - qmlRegisterType<QQuickWheelHandler>(uri, 2, 14, "WheelHandler"); + qmlRegisterTypesAndRevisions<QQuickWheelHandler>(uri, major); #endif - qmlRegisterUncreatableType<QQuickImageBase, 14>(uri, 2, 14, "ImageBase", - QQuickPointerHandler::tr("ImageBase is an abstract base class")); - qmlRegisterType<QQuickImage, 14>(uri, 2, 14, "Image"); - qmlRegisterType<QQuickDragHandler, 14>(uri, 2, 14, "DragHandler"); - - qmlRegisterUncreatableType<QQuickPointerHandler, 15>(uri, 2, 15, "PointerHandler", - QQuickPointerHandler::tr("PointerHandler is an abstract base class")); } static void initResources() @@ -512,12 +399,7 @@ QT_BEGIN_NAMESPACE void QQuickItemsModule::defineModule() { initResources(); - - QByteArray name = "QtQuick"; - int majorVersion = 2; - int minorVersion = 0; - - qt_quickitems_defineModule(name, majorVersion, minorVersion); + qt_quickitems_defineModule(); } QT_END_NAMESPACE diff --git a/src/quick/items/qquickitemsmodule_p.h b/src/quick/items/qquickitemsmodule_p.h index cd79efe256..6ceb0d56e6 100644 --- a/src/quick/items/qquickitemsmodule_p.h +++ b/src/quick/items/qquickitemsmodule_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtGui/qevent.h> #include <qqml.h> QT_BEGIN_NAMESPACE @@ -61,6 +62,15 @@ public: static void defineModule(); }; +struct QPointingDeviceUniqueIdForeign +{ + Q_GADGET + QML_FOREIGN(QPointingDeviceUniqueId) + QML_NAMED_ELEMENT(PointingDeviceUniqueId) + QML_ADDED_IN_MINOR_VERSION(9) + QML_UNCREATABLE("PointingDeviceUniqueId is only available via read-only properties.") +}; + QT_END_NAMESPACE #endif // QQUICKITEMSMODULE_P_H diff --git a/src/quick/items/qquickitemview_p.h b/src/quick/items/qquickitemview_p.h index 66e09f9ed1..6bc00411f0 100644 --- a/src/quick/items/qquickitemview_p.h +++ b/src/quick/items/qquickitemview_p.h @@ -110,6 +110,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickItemView : public QQuickFlickable Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged RESET resetPreferredHighlightEnd) Q_PROPERTY(int highlightMoveDuration READ highlightMoveDuration WRITE setHighlightMoveDuration NOTIFY highlightMoveDurationChanged) + QML_NAMED_ELEMENT(ItemView) + QML_UNCREATABLE("ItemView is an abstract base class.") + QML_ADDED_IN_MINOR_VERSION(1) + public: // this holds all layout enum values so they can be referred to by other enums // to ensure consistent values - e.g. QML references to GridView.TopToBottom flow diff --git a/src/quick/items/qquickitemviewtransition_p.h b/src/quick/items/qquickitemviewtransition_p.h index 0c7a9cad75..5f4e74171e 100644 --- a/src/quick/items/qquickitemviewtransition_p.h +++ b/src/quick/items/qquickitemviewtransition_p.h @@ -194,6 +194,10 @@ class QQuickViewTransitionAttached : public QObject Q_PROPERTY(QList<int> targetIndexes READ targetIndexes NOTIFY targetIndexesChanged) Q_PROPERTY(QQmlListProperty<QObject> targetItems READ targetItems NOTIFY targetItemsChanged) + QML_NAMED_ELEMENT(ViewTransition) + QML_UNCREATABLE("ViewTransition is only available via attached properties.") + QML_ATTACHED(QQuickViewTransitionAttached) + public: QQuickViewTransitionAttached(QObject *parent); @@ -227,6 +231,5 @@ private: QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickViewTransitionAttached) -QML_DECLARE_TYPEINFO(QQuickViewTransitionAttached, QML_HAS_ATTACHED_PROPERTIES) #endif // QQUICKITEMVIEWTRANSITION_P_P_H diff --git a/src/quick/items/qquicklistview_p.h b/src/quick/items/qquicklistview_p.h index f2bab9e018..1c72a10190 100644 --- a/src/quick/items/qquicklistview_p.h +++ b/src/quick/items/qquicklistview_p.h @@ -70,6 +70,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickViewSection : public QObject Q_PROPERTY(SectionCriteria criteria READ criteria WRITE setCriteria NOTIFY criteriaChanged) Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) Q_PROPERTY(int labelPositioning READ labelPositioning WRITE setLabelPositioning NOTIFY labelPositioningChanged) + QML_NAMED_ELEMENT(ViewSection) public: QQuickViewSection(QQuickListView *parent=nullptr); @@ -130,6 +131,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickListView : public QQuickItemView Q_PROPERTY(FooterPositioning footerPositioning READ footerPositioning WRITE setFooterPositioning NOTIFY footerPositioningChanged REVISION 4) Q_CLASSINFO("DefaultProperty", "data") + QML_NAMED_ELEMENT(ListView) + QML_ATTACHED(QQuickListViewAttached) public: QQuickListView(QQuickItem *parent=nullptr); @@ -216,7 +219,6 @@ public: QT_END_NAMESPACE -QML_DECLARE_TYPEINFO(QQuickListView, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QQuickListView) QML_DECLARE_TYPE(QQuickViewSection) diff --git a/src/quick/items/qquickloader_p.h b/src/quick/items/qquickloader_p.h index de1dfa9da5..2d560fb856 100644 --- a/src/quick/items/qquickloader_p.h +++ b/src/quick/items/qquickloader_p.h @@ -67,6 +67,7 @@ class Q_AUTOTEST_EXPORT QQuickLoader : public QQuickImplicitSizeItem Q_PROPERTY(Status status READ status NOTIFY statusChanged) Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged) + QML_NAMED_ELEMENT(Loader) public: QQuickLoader(QQuickItem *parent = nullptr); diff --git a/src/quick/items/qquickmousearea_p.h b/src/quick/items/qquickmousearea_p.h index 0e01fa7915..3d4d113215 100644 --- a/src/quick/items/qquickmousearea_p.h +++ b/src/quick/items/qquickmousearea_p.h @@ -85,6 +85,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickMouseArea : public QQuickItem #endif Q_PROPERTY(bool containsPress READ containsPress NOTIFY containsPressChanged REVISION 4) Q_PROPERTY(int pressAndHoldInterval READ pressAndHoldInterval WRITE setPressAndHoldInterval NOTIFY pressAndHoldIntervalChanged RESET resetPressAndHoldInterval REVISION 9) + QML_NAMED_ELEMENT(MouseArea) public: QQuickMouseArea(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h index 634ea1c2e2..7506be10a1 100644 --- a/src/quick/items/qquickmultipointtoucharea_p.h +++ b/src/quick/items/qquickmultipointtoucharea_p.h @@ -83,6 +83,7 @@ class Q_AUTOTEST_EXPORT QQuickTouchPoint : public QObject Q_PROPERTY(qreal previousY READ previousY NOTIFY previousYChanged) Q_PROPERTY(qreal sceneX READ sceneX NOTIFY sceneXChanged) Q_PROPERTY(qreal sceneY READ sceneY NOTIFY sceneYChanged) + QML_NAMED_ELEMENT(TouchPoint) public: QQuickTouchPoint(bool qmlDefined = true) @@ -187,6 +188,9 @@ class QQuickGrabGestureEvent : public QObject Q_OBJECT Q_PROPERTY(QQmlListProperty<QObject> touchPoints READ touchPoints CONSTANT) Q_PROPERTY(qreal dragThreshold READ dragThreshold CONSTANT) + QML_NAMED_ELEMENT(GestureEvent) + QML_UNCREATABLE("GestureEvent is only available in the context of handling the gestureStarted signal from MultiPointTouchArea.") + public: QQuickGrabGestureEvent() : _dragThreshold(QGuiApplication::styleHints()->startDragDistance()) {} @@ -213,6 +217,7 @@ class Q_AUTOTEST_EXPORT QQuickMultiPointTouchArea : public QQuickItem Q_PROPERTY(int minimumTouchPoints READ minimumTouchPoints WRITE setMinimumTouchPoints NOTIFY minimumTouchPointsChanged) Q_PROPERTY(int maximumTouchPoints READ maximumTouchPoints WRITE setMaximumTouchPoints NOTIFY maximumTouchPointsChanged) Q_PROPERTY(bool mouseEnabled READ mouseEnabled WRITE setMouseEnabled NOTIFY mouseEnabledChanged) + QML_NAMED_ELEMENT(MultiPointTouchArea) public: QQuickMultiPointTouchArea(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickopenglinfo_p.h b/src/quick/items/qquickopenglinfo_p.h index 86683d5348..b733d205e3 100644 --- a/src/quick/items/qquickopenglinfo_p.h +++ b/src/quick/items/qquickopenglinfo_p.h @@ -70,6 +70,11 @@ class QQuickOpenGLInfo : public QObject Q_PROPERTY(ContextProfile profile READ profile NOTIFY profileChanged FINAL) Q_PROPERTY(RenderableType renderableType READ renderableType NOTIFY renderableTypeChanged FINAL) + QML_NAMED_ELEMENT(OpenGLInfo) + QML_UNCREATABLE("OpenGLInfo is only available via attached properties.") + QML_ADDED_IN_MINOR_VERSION(4) + QML_ATTACHED(QQuickOpenGLInfo) + public: QQuickOpenGLInfo(QQuickItem *item = 0); @@ -116,6 +121,4 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPEINFO(QQuickOpenGLInfo, QML_HAS_ATTACHED_PROPERTIES) - #endif // QQUICKOPENGLINFO_P_H diff --git a/src/quick/items/qquickpainteditem.h b/src/quick/items/qquickpainteditem.h index ddc1fd99d9..4821a409be 100644 --- a/src/quick/items/qquickpainteditem.h +++ b/src/quick/items/qquickpainteditem.h @@ -56,6 +56,9 @@ class Q_QUICK_EXPORT QQuickPaintedItem : public QQuickItem Q_PROPERTY(RenderTarget renderTarget READ renderTarget WRITE setRenderTarget NOTIFY renderTargetChanged) Q_PROPERTY(QSize textureSize READ textureSize WRITE setTextureSize NOTIFY textureSizeChanged) + QML_NAMED_ELEMENT(PaintedItem) + QML_UNCREATABLE("Cannot create instance of abstract class PaintedItem.") + public: explicit QQuickPaintedItem(QQuickItem *parent = nullptr); ~QQuickPaintedItem() override; diff --git a/src/quick/items/qquickpathview_p.h b/src/quick/items/qquickpathview_p.h index 66be7fa6ff..c12358e4f6 100644 --- a/src/quick/items/qquickpathview_p.h +++ b/src/quick/items/qquickpathview_p.h @@ -100,6 +100,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathView : public QQuickItem Q_PROPERTY(MovementDirection movementDirection READ movementDirection WRITE setMovementDirection NOTIFY movementDirectionChanged REVISION 7) Q_PROPERTY(int cacheItemCount READ cacheItemCount WRITE setCacheItemCount NOTIFY cacheItemCountChanged) + QML_NAMED_ELEMENT(PathView) + QML_ATTACHED(QQuickPathViewAttached) public: QQuickPathView(QQuickItem *parent = nullptr); @@ -299,6 +301,5 @@ private: QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickPathView) -QML_DECLARE_TYPEINFO(QQuickPathView, QML_HAS_ATTACHED_PROPERTIES) #endif // QQUICKPATHVIEW_P_H diff --git a/src/quick/items/qquickpincharea_p.h b/src/quick/items/qquickpincharea_p.h index cf21555823..d7f814cc8a 100644 --- a/src/quick/items/qquickpincharea_p.h +++ b/src/quick/items/qquickpincharea_p.h @@ -70,6 +70,7 @@ class Q_AUTOTEST_EXPORT QQuickPinch : public QObject Q_PROPERTY(qreal minimumY READ ymin WRITE setYmin NOTIFY minimumYChanged) Q_PROPERTY(qreal maximumY READ ymax WRITE setYmax NOTIFY maximumYChanged) Q_PROPERTY(bool active READ active NOTIFY activeChanged) + QML_NAMED_ELEMENT(Pinch) public: QQuickPinch(); @@ -210,6 +211,7 @@ class Q_AUTOTEST_EXPORT QQuickPinchEvent : public QObject Q_PROPERTY(QPointF startPoint2 READ startPoint2) Q_PROPERTY(int pointCount READ pointCount) Q_PROPERTY(bool accepted READ accepted WRITE setAccepted) + QML_ANONYMOUS public: QQuickPinchEvent(QPointF c, qreal s, qreal a, qreal r) @@ -268,6 +270,7 @@ class Q_AUTOTEST_EXPORT QQuickPinchArea : public QQuickItem Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) Q_PROPERTY(QQuickPinch *pinch READ pinch CONSTANT) + QML_NAMED_ELEMENT(PinchArea) public: QQuickPinchArea(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickpositioners_p.h b/src/quick/items/qquickpositioners_p.h index 94a737e1f1..b924cb9c12 100644 --- a/src/quick/items/qquickpositioners_p.h +++ b/src/quick/items/qquickpositioners_p.h @@ -112,6 +112,11 @@ class Q_QUICK_PRIVATE_EXPORT QQuickBasePositioner : public QQuickImplicitSizeIte Q_PROPERTY(qreal leftPadding READ leftPadding WRITE setLeftPadding RESET resetLeftPadding NOTIFY leftPaddingChanged REVISION 6) Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged REVISION 6) Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged REVISION 6) + + QML_NAMED_ELEMENT(Positioner) + QML_UNCREATABLE("Positioner is an abstract type that is only available as an attached property.") + QML_ATTACHED(QQuickPositionerAttached) + public: enum PositionerType { None = 0x0, Horizontal = 0x1, Vertical = 0x2, Both = 0x3 }; @@ -230,6 +235,7 @@ private: class Q_AUTOTEST_EXPORT QQuickColumn : public QQuickBasePositioner { Q_OBJECT + QML_NAMED_ELEMENT(Column) public: QQuickColumn(QQuickItem *parent=nullptr); @@ -246,6 +252,8 @@ class Q_AUTOTEST_EXPORT QQuickRow: public QQuickBasePositioner Q_OBJECT Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged) Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged) + QML_NAMED_ELEMENT(Row) + public: QQuickRow(QQuickItem *parent=nullptr); @@ -279,6 +287,7 @@ class Q_AUTOTEST_EXPORT QQuickGrid : public QQuickBasePositioner Q_PROPERTY(HAlignment horizontalItemAlignment READ hItemAlign WRITE setHItemAlign NOTIFY horizontalAlignmentChanged REVISION 1) Q_PROPERTY(HAlignment effectiveHorizontalItemAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1) Q_PROPERTY(VAlignment verticalItemAlignment READ vItemAlign WRITE setVItemAlign NOTIFY verticalAlignmentChanged REVISION 1) + QML_NAMED_ELEMENT(Grid) public: QQuickGrid(QQuickItem *parent=nullptr); @@ -359,6 +368,7 @@ class Q_AUTOTEST_EXPORT QQuickFlow: public QQuickBasePositioner Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged) Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged) + QML_NAMED_ELEMENT(Flow) public: QQuickFlow(QQuickItem *parent=nullptr); @@ -395,6 +405,5 @@ QML_DECLARE_TYPE(QQuickGrid) QML_DECLARE_TYPE(QQuickFlow) QML_DECLARE_TYPE(QQuickBasePositioner) -QML_DECLARE_TYPEINFO(QQuickBasePositioner, QML_HAS_ATTACHED_PROPERTIES) #endif // QQUICKPOSITIONERS_P_H diff --git a/src/quick/items/qquickrectangle_p.h b/src/quick/items/qquickrectangle_p.h index d56a03d22d..934300b63b 100644 --- a/src/quick/items/qquickrectangle_p.h +++ b/src/quick/items/qquickrectangle_p.h @@ -66,6 +66,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPen : public QObject Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY penChanged) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY penChanged) Q_PROPERTY(bool pixelAligned READ pixelAligned WRITE setPixelAligned NOTIFY penChanged) + QML_ANONYMOUS public: QQuickPen(QObject *parent=nullptr); @@ -96,6 +97,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickGradientStop : public QObject Q_PROPERTY(qreal position READ position WRITE setPosition) Q_PROPERTY(QColor color READ color WRITE setColor) + QML_NAMED_ELEMENT(GradientStop) public: QQuickGradientStop(QObject *parent=nullptr); @@ -121,6 +123,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickGradient : public QObject Q_PROPERTY(QQmlListProperty<QQuickGradientStop> stops READ stops) Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged REVISION 12) Q_CLASSINFO("DefaultProperty", "stops") + QML_NAMED_ELEMENT(Gradient) Q_ENUMS(QGradient::Preset) public: @@ -161,6 +164,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickRectangle : public QQuickItem Q_PROPERTY(QJSValue gradient READ gradient WRITE setGradient RESET resetGradient) Q_PROPERTY(QQuickPen * border READ border CONSTANT) Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged) + QML_NAMED_ELEMENT(Rectangle) public: QQuickRectangle(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickrepeater_p.h b/src/quick/items/qquickrepeater_p.h index dbe3cd0c55..20984fa23e 100644 --- a/src/quick/items/qquickrepeater_p.h +++ b/src/quick/items/qquickrepeater_p.h @@ -70,6 +70,7 @@ class Q_AUTOTEST_EXPORT QQuickRepeater : public QQuickItem Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) Q_PROPERTY(int count READ count NOTIFY countChanged) Q_CLASSINFO("DefaultProperty", "delegate") + QML_NAMED_ELEMENT(Repeater) public: QQuickRepeater(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquickscalegrid_p_p.h b/src/quick/items/qquickscalegrid_p_p.h index f5187a8eea..56b0ee86ab 100644 --- a/src/quick/items/qquickscalegrid_p_p.h +++ b/src/quick/items/qquickscalegrid_p_p.h @@ -69,6 +69,7 @@ class Q_AUTOTEST_EXPORT QQuickScaleGrid : public QObject Q_PROPERTY(int top READ top WRITE setTop NOTIFY topBorderChanged) Q_PROPERTY(int right READ right WRITE setRight NOTIFY rightBorderChanged) Q_PROPERTY(int bottom READ bottom WRITE setBottom NOTIFY bottomBorderChanged) + QML_ANONYMOUS public: QQuickScaleGrid(QObject *parent=nullptr); diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h index 10e524e4a0..9d9f9a1567 100644 --- a/src/quick/items/qquickscreen_p.h +++ b/src/quick/items/qquickscreen_p.h @@ -86,6 +86,10 @@ class Q_AUTOTEST_EXPORT QQuickScreenInfo : public QObject Q_PROPERTY(int virtualX READ virtualX NOTIFY virtualXChanged REVISION 3) Q_PROPERTY(int virtualY READ virtualY NOTIFY virtualYChanged REVISION 3) + QML_NAMED_ELEMENT(ScreenInfo) + QML_ADDED_IN_MINOR_VERSION(3) + QML_UNCREATABLE("ScreenInfo can only be used via the attached property.") + public: QQuickScreenInfo(QObject *parent = nullptr, QScreen *wrappedScreen = nullptr); @@ -161,13 +165,16 @@ private: class Q_AUTOTEST_EXPORT QQuickScreen : public QObject { Q_OBJECT + QML_NAMED_ELEMENT(Screen) + QML_UNCREATABLE("Screen can only be used via the attached property.") + QML_ATTACHED(QQuickScreenAttached) + public: static QQuickScreenAttached *qmlAttachedProperties(QObject *object){ return new QQuickScreenAttached(object); } }; QT_END_NAMESPACE -QML_DECLARE_TYPEINFO(QQuickScreen, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QQuickScreenInfo) #endif diff --git a/src/quick/items/qquickshadereffect_p.h b/src/quick/items/qquickshadereffect_p.h index 6e2f35882b..c14907092c 100644 --- a/src/quick/items/qquickshadereffect_p.h +++ b/src/quick/items/qquickshadereffect_p.h @@ -75,6 +75,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickShaderEffect : public QQuickItem Q_PROPERTY(QString log READ log NOTIFY logChanged) Q_PROPERTY(Status status READ status NOTIFY statusChanged) Q_PROPERTY(bool supportsAtlasTextures READ supportsAtlasTextures WRITE setSupportsAtlasTextures NOTIFY supportsAtlasTexturesChanged REVISION 4) + QML_NAMED_ELEMENT(ShaderEffect) public: enum CullMode { diff --git a/src/quick/items/qquickshadereffectmesh_p.h b/src/quick/items/qquickshadereffectmesh_p.h index 79e05a5f9f..710d37c275 100644 --- a/src/quick/items/qquickshadereffectmesh_p.h +++ b/src/quick/items/qquickshadereffectmesh_p.h @@ -49,6 +49,7 @@ QT_REQUIRE_CONFIG(quick_shadereffect); #include <QtCore/qsize.h> #include <QtCore/qvector.h> #include <QtCore/qbytearray.h> +#include <QtQml/qqml.h> #ifndef QQUICKSHADEREFFECTMESH_P_H #define QQUICKSHADEREFFECTMESH_P_H @@ -75,6 +76,10 @@ class QRectF; class Q_QUICK_PRIVATE_EXPORT QQuickShaderEffectMesh : public QObject { Q_OBJECT + + QML_NAMED_ELEMENT(ShaderEffectMesh) + QML_UNCREATABLE("Cannot create instance of abstract class ShaderEffectMesh.") + public: QQuickShaderEffectMesh(QObject *parent = nullptr); virtual bool validateAttributes(const QVector<QByteArray> &attributes, int *posIndex) = 0; @@ -96,6 +101,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickGridMesh : public QQuickShaderEffectMesh { Q_OBJECT Q_PROPERTY(QSize resolution READ resolution WRITE setResolution NOTIFY resolutionChanged) + QML_NAMED_ELEMENT(GridMesh) public: QQuickGridMesh(QObject *parent = nullptr); bool validateAttributes(const QVector<QByteArray> &attributes, int *posIndex) override; @@ -123,6 +129,10 @@ class QQuickBorderImageMesh : public QQuickShaderEffectMesh Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY sizeChanged) Q_PROPERTY(TileMode horizontalTileMode READ horizontalTileMode WRITE setHorizontalTileMode NOTIFY horizontalTileModeChanged) Q_PROPERTY(TileMode verticalTileMode READ verticalTileMode WRITE setVerticalTileMode NOTIFY verticalTileModeChanged) + + QML_NAMED_ELEMENT(BorderImageMesh) + QML_ADDED_IN_MINOR_VERSION(8) + public: QQuickBorderImageMesh(QObject *parent = nullptr); diff --git a/src/quick/items/qquickshadereffectsource_p.h b/src/quick/items/qquickshadereffectsource_p.h index d612d1179f..c0a1ccab78 100644 --- a/src/quick/items/qquickshadereffectsource_p.h +++ b/src/quick/items/qquickshadereffectsource_p.h @@ -89,6 +89,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickShaderEffectSource : public QQuickItem, publi Q_PROPERTY(bool recursive READ recursive WRITE setRecursive NOTIFY recursiveChanged) Q_PROPERTY(TextureMirroring textureMirroring READ textureMirroring WRITE setTextureMirroring NOTIFY textureMirroringChanged REVISION 6) Q_PROPERTY(int samples READ samples WRITE setSamples NOTIFY samplesChanged REVISION 9) + QML_NAMED_ELEMENT(ShaderEffectSource) public: enum WrapMode { diff --git a/src/quick/items/qquicksprite_p.h b/src/quick/items/qquicksprite_p.h index fab9e75190..98e5b82db8 100644 --- a/src/quick/items/qquicksprite_p.h +++ b/src/quick/items/qquicksprite_p.h @@ -86,6 +86,7 @@ class Q_QUICK_EXPORT QQuickSprite : public QQuickStochasticState Q_PROPERTY(qreal frameRateVariation READ frameRateVariation WRITE setFrameRateVariation NOTIFY frameRateVariationChanged) Q_PROPERTY(int frameDuration READ frameDuration WRITE setFrameDuration NOTIFY frameDurationChanged RESET resetFrameDuration) Q_PROPERTY(int frameDurationVariation READ frameDurationVariation WRITE setFrameDurationVariation NOTIFY frameDurationVariationChanged) + QML_NAMED_ELEMENT(Sprite) public: explicit QQuickSprite(QObject *parent = nullptr); diff --git a/src/quick/items/qquickspritesequence_p.h b/src/quick/items/qquickspritesequence_p.h index 12c80d6a27..8361f7832a 100644 --- a/src/quick/items/qquickspritesequence_p.h +++ b/src/quick/items/qquickspritesequence_p.h @@ -74,6 +74,7 @@ class Q_AUTOTEST_EXPORT QQuickSpriteSequence : public QQuickItem //###try to share similar spriteEngines for less overhead? Q_PROPERTY(QQmlListProperty<QQuickSprite> sprites READ sprites) Q_CLASSINFO("DefaultProperty", "sprites") + QML_NAMED_ELEMENT(SpriteSequence) public: explicit QQuickSpriteSequence(QQuickItem *parent = nullptr); diff --git a/src/quick/items/qquickstateoperations_p.h b/src/quick/items/qquickstateoperations_p.h index e947b2213f..c207a055cd 100644 --- a/src/quick/items/qquickstateoperations_p.h +++ b/src/quick/items/qquickstateoperations_p.h @@ -74,6 +74,7 @@ class Q_AUTOTEST_EXPORT QQuickParentChange : public QQuickStateOperation, public Q_PROPERTY(QQmlScriptString height READ height WRITE setHeight) Q_PROPERTY(QQmlScriptString scale READ scale WRITE setScale) Q_PROPERTY(QQmlScriptString rotation READ rotation WRITE setRotation) + QML_NAMED_ELEMENT(ParentChange) public: QQuickParentChange(QObject *parent=nullptr); ~QQuickParentChange(); @@ -136,6 +137,7 @@ class Q_AUTOTEST_EXPORT QQuickAnchorSet : public QObject Q_PROPERTY(QQmlScriptString bottom READ bottom WRITE setBottom RESET resetBottom) Q_PROPERTY(QQmlScriptString verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter) Q_PROPERTY(QQmlScriptString baseline READ baseline WRITE setBaseline RESET resetBaseline) + QML_ANONYMOUS public: QQuickAnchorSet(QObject *parent=nullptr); @@ -185,6 +187,7 @@ class Q_AUTOTEST_EXPORT QQuickAnchorChanges : public QQuickStateOperation, publi Q_PROPERTY(QQuickItem *target READ object WRITE setObject) Q_PROPERTY(QQuickAnchorSet *anchors READ anchors CONSTANT) + QML_NAMED_ELEMENT(AnchorChanges) public: QQuickAnchorChanges(QObject *parent=nullptr); diff --git a/src/quick/items/qquicktableview_p.h b/src/quick/items/qquicktableview_p.h index 3b113efa4f..2208891f50 100644 --- a/src/quick/items/qquicktableview_p.h +++ b/src/quick/items/qquicktableview_p.h @@ -82,6 +82,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTableView : public QQuickFlickable Q_PROPERTY(QQuickTableView *syncView READ syncView WRITE setSyncView NOTIFY syncViewChanged REVISION 14) Q_PROPERTY(Qt::Orientations syncDirection READ syncDirection WRITE setSyncDirection NOTIFY syncDirectionChanged REVISION 14) + QML_NAMED_ELEMENT(TableView) + QML_ADDED_IN_MINOR_VERSION(12) + QML_ATTACHED(QQuickTableViewAttached) + public: QQuickTableView(QQuickItem *parent = nullptr); ~QQuickTableView() override; @@ -186,6 +190,5 @@ private: QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickTableView) -QML_DECLARE_TYPEINFO(QQuickTableView, QML_HAS_ATTACHED_PROPERTIES) #endif // QQUICKTABLEVIEW_P_H diff --git a/src/quick/items/qquicktext_p.h b/src/quick/items/qquicktext_p.h index 45f387cb12..394ea25b83 100644 --- a/src/quick/items/qquicktext_p.h +++ b/src/quick/items/qquicktext_p.h @@ -100,6 +100,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickText : public QQuickImplicitSizeItem Q_PROPERTY(QJSValue fontInfo READ fontInfo NOTIFY fontInfoChanged REVISION 9) Q_PROPERTY(QSizeF advance READ advance NOTIFY contentSizeChanged REVISION 10) + QML_NAMED_ELEMENT(Text) public: QQuickText(QQuickItem *parent=nullptr); @@ -329,6 +330,7 @@ class QQuickTextLine : public QObject Q_PROPERTY(qreal height READ height WRITE setHeight) Q_PROPERTY(qreal x READ x WRITE setX) Q_PROPERTY(qreal y READ y WRITE setY) + QML_ANONYMOUS public: QQuickTextLine(); diff --git a/src/quick/items/qquicktextdocument.h b/src/quick/items/qquicktextdocument.h index affa0ab4d6..bf9162755c 100644 --- a/src/quick/items/qquicktextdocument.h +++ b/src/quick/items/qquicktextdocument.h @@ -49,6 +49,7 @@ class QQuickTextDocumentPrivate; class Q_QUICK_EXPORT QQuickTextDocument : public QObject { Q_OBJECT + QML_ANONYMOUS public: QQuickTextDocument(QQuickItem *parent); diff --git a/src/quick/items/qquicktextedit_p.h b/src/quick/items/qquicktextedit_p.h index 2d1b6c7f9c..227d8cbf51 100644 --- a/src/quick/items/qquicktextedit_p.h +++ b/src/quick/items/qquicktextedit_p.h @@ -112,6 +112,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTextEdit : public QQuickImplicitSizeItem Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged REVISION 6) Q_PROPERTY(QString preeditText READ preeditText NOTIFY preeditTextChanged REVISION 7) Q_PROPERTY(qreal tabStopDistance READ tabStopDistance WRITE setTabStopDistance NOTIFY tabStopDistanceChanged REVISION 10) + QML_NAMED_ELEMENT(TextEdit) public: QQuickTextEdit(QQuickItem *parent=nullptr); diff --git a/src/quick/items/qquicktextinput_p.h b/src/quick/items/qquicktextinput_p.h index 92f3aa62ce..e95717cf8c 100644 --- a/src/quick/items/qquicktextinput_p.h +++ b/src/quick/items/qquicktextinput_p.h @@ -113,6 +113,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTextInput : public QQuickImplicitSizeItem Q_PROPERTY(qreal leftPadding READ leftPadding WRITE setLeftPadding RESET resetLeftPadding NOTIFY leftPaddingChanged REVISION 6) Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged REVISION 6) Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged REVISION 6) + QML_NAMED_ELEMENT(TextInput) public: QQuickTextInput(QQuickItem * parent=nullptr); diff --git a/src/quick/items/qquicktranslate_p.h b/src/quick/items/qquicktranslate_p.h index b6ea43342c..aeda6ca589 100644 --- a/src/quick/items/qquicktranslate_p.h +++ b/src/quick/items/qquicktranslate_p.h @@ -64,6 +64,7 @@ class Q_AUTOTEST_EXPORT QQuickTranslate : public QQuickTransform Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged) Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged) + QML_NAMED_ELEMENT(Translate) public: QQuickTranslate(QObject *parent = nullptr); @@ -95,6 +96,7 @@ class Q_AUTOTEST_EXPORT QQuickScale : public QQuickTransform Q_PROPERTY(qreal xScale READ xScale WRITE setXScale NOTIFY xScaleChanged) Q_PROPERTY(qreal yScale READ yScale WRITE setYScale NOTIFY yScaleChanged) Q_PROPERTY(qreal zScale READ zScale WRITE setZScale NOTIFY zScaleChanged) + QML_NAMED_ELEMENT(Scale) public: QQuickScale(QObject *parent = nullptr); ~QQuickScale(); @@ -132,6 +134,7 @@ class Q_AUTOTEST_EXPORT QQuickRotation : public QQuickTransform Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged) Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged) Q_PROPERTY(QVector3D axis READ axis WRITE setAxis NOTIFY axisChanged) + QML_NAMED_ELEMENT(Rotation) public: QQuickRotation(QObject *parent = nullptr); ~QQuickRotation(); @@ -163,6 +166,8 @@ class Q_AUTOTEST_EXPORT QQuickMatrix4x4 : public QQuickTransform Q_OBJECT Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix NOTIFY matrixChanged) + QML_NAMED_ELEMENT(Matrix4x4) + QML_ADDED_IN_MINOR_VERSION(3) public: QQuickMatrix4x4(QObject *parent = nullptr); ~QQuickMatrix4x4(); diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h index 9dbff88f0d..db382de459 100644 --- a/src/quick/items/qquickwindow.h +++ b/src/quick/items/qquickwindow.h @@ -76,6 +76,9 @@ class Q_QUICK_EXPORT QQuickWindow : public QWindow Q_PROPERTY(QQuickItem* contentItem READ contentItem CONSTANT) Q_PROPERTY(QQuickItem* activeFocusItem READ activeFocusItem NOTIFY activeFocusItemChanged REVISION 1) Q_CLASSINFO("DefaultProperty", "data") + QML_NAMED_ELEMENT(Window) + QML_ADDED_IN_MINOR_VERSION(0) + QML_REMOVED_IN_MINOR_VERSION(1) Q_DECLARE_PRIVATE(QQuickWindow) public: enum CreateTextureOption { diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp index 4b2b8f498d..0f952d194c 100644 --- a/src/quick/items/qquickwindowmodule.cpp +++ b/src/quick/items/qquickwindowmodule.cpp @@ -199,22 +199,13 @@ void QQuickWindowModule::defineModule() { const char uri[] = "QtQuick.Window"; - qmlRegisterType<QQuickWindow>(uri, 2, 0, "Window"); + // Cannot automatically register these. They are from QtGui. qmlRegisterRevision<QWindow,1>(uri, 2, 1); qmlRegisterRevision<QWindow,2>(uri, 2, 2); - qmlRegisterRevision<QQuickWindow,1>(uri, 2, 1);//Type moved to a subclass, but also has new members - qmlRegisterRevision<QQuickWindow,2>(uri, 2, 2); - qmlRegisterType<QQuickWindowQmlImpl>(uri, 2, 1, "Window"); - qmlRegisterType<QQuickWindowQmlImpl,2>(uri, 2, 2, "Window"); - qmlRegisterType<QQuickWindowQmlImpl,3>(uri, 2, 3, "Window"); - qmlRegisterUncreatableType<QQuickScreen>(uri, 2, 0, "Screen", QStringLiteral("Screen can only be used via the attached property.")); - qmlRegisterUncreatableType<QQuickScreen,3>(uri, 2, 3, "Screen", QStringLiteral("Screen can only be used via the attached property.")); - qmlRegisterUncreatableType<QQuickScreenInfo,3>(uri, 2, 3, "ScreenInfo", QStringLiteral("ScreenInfo can only be used via the attached property.")); - qmlRegisterUncreatableType<QQuickScreenInfo,10>(uri, 2, 10, "ScreenInfo", QStringLiteral("ScreenInfo can only be used via the attached property.")); qmlRegisterRevision<QWindow,13>(uri, 2, 13); - qmlRegisterRevision<QQuickWindow,13>(uri, 2, 13); - qmlRegisterType<QQuickWindowQmlImpl,13>(uri, 2, 13, "Window"); - qmlRegisterRevision<QQuickWindow,14>(uri, 2, 14); + + qmlRegisterTypesAndRevisions<QQuickWindow, QQuickWindowQmlImpl, + QQuickScreen, QQuickScreenInfo>(uri, 2); } QT_END_NAMESPACE diff --git a/src/quick/items/qquickwindowmodule_p.h b/src/quick/items/qquickwindowmodule_p.h index 1dcf1a1021..1769e5aeb4 100644 --- a/src/quick/items/qquickwindowmodule_p.h +++ b/src/quick/items/qquickwindowmodule_p.h @@ -68,6 +68,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickWindowQmlImpl : public QQuickWindow, public Q Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) Q_PROPERTY(Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged) Q_PROPERTY(QObject *screen READ screen WRITE setScreen NOTIFY screenChanged REVISION 3) + QML_NAMED_ELEMENT(Window) + QML_ADDED_IN_MINOR_VERSION(1) + QML_ATTACHED(QQuickWindowAttached) public: QQuickWindowQmlImpl(QWindow *parent = nullptr); @@ -106,6 +109,5 @@ public: QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickWindowQmlImpl) -QML_DECLARE_TYPEINFO(QQuickWindowQmlImpl, QML_HAS_ATTACHED_PROPERTIES) #endif diff --git a/src/quick/qtquick2.cpp b/src/quick/qtquick2.cpp index 7a04c2146c..527742ab8a 100644 --- a/src/quick/qtquick2.cpp +++ b/src/quick/qtquick2.cpp @@ -185,8 +185,6 @@ void QQmlQtQuick2Module::defineModule() QQuickUtilModule::defineModule(); QQuickItemsModule::defineModule(); - qmlRegisterUncreatableType<QQuickApplication>("QtQuick",2,0,"Application", QQuickApplication::tr("Application is an abstract class")); - QQuickValueTypes::registerValueTypes(); #if QT_CONFIG(accessibility) diff --git a/src/quick/util/qquickanimation_p.h b/src/quick/util/qquickanimation_p.h index 746cb938bd..45f1635c91 100644 --- a/src/quick/util/qquickanimation_p.h +++ b/src/quick/util/qquickanimation_p.h @@ -80,6 +80,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickAbstractAnimation : public QObject, public QQ Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopCountChanged) Q_CLASSINFO("DefaultMethod", "start()") + QML_NAMED_ELEMENT(Animation) + QML_UNCREATABLE("Animation is an abstract class") + public: enum ThreadingModel { GuiThread, @@ -165,6 +168,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPauseAnimation : public QQuickAbstractAnimati Q_DECLARE_PRIVATE(QQuickPauseAnimation) Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) + QML_NAMED_ELEMENT(PauseAnimation) public: QQuickPauseAnimation(QObject *parent=nullptr); @@ -191,6 +195,7 @@ class QQuickScriptAction : public QQuickAbstractAnimation Q_PROPERTY(QQmlScriptString script READ script WRITE setScript) Q_PROPERTY(QString scriptName READ stateChangeScriptName WRITE setStateChangeScriptName) + QML_NAMED_ELEMENT(ScriptAction) public: QQuickScriptAction(QObject *parent=nullptr); @@ -221,6 +226,7 @@ class QQuickPropertyAction : public QQuickAbstractAnimation Q_PROPERTY(QQmlListProperty<QObject> targets READ targets) Q_PROPERTY(QQmlListProperty<QObject> exclude READ exclude) Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) + QML_NAMED_ELEMENT(PropertyAction) public: QQuickPropertyAction(QObject *parent=nullptr); @@ -269,6 +275,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPropertyAnimation : public QQuickAbstractAnim Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged) Q_PROPERTY(QQmlListProperty<QObject> targets READ targets) Q_PROPERTY(QQmlListProperty<QObject> exclude READ exclude) + QML_NAMED_ELEMENT(PropertyAnimation) public: QQuickPropertyAnimation(QObject *parent=nullptr); @@ -324,6 +331,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickColorAnimation : public QQuickPropertyAnimati Q_DECLARE_PRIVATE(QQuickPropertyAnimation) Q_PROPERTY(QColor from READ from WRITE setFrom) Q_PROPERTY(QColor to READ to WRITE setTo) + QML_NAMED_ELEMENT(ColorAnimation) public: QQuickColorAnimation(QObject *parent=nullptr); @@ -343,6 +351,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickNumberAnimation : public QQuickPropertyAnimat Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged) Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) + QML_NAMED_ELEMENT(NumberAnimation) public: QQuickNumberAnimation(QObject *parent=nullptr); @@ -368,6 +377,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickVector3dAnimation : public QQuickPropertyAnim Q_PROPERTY(QVector3D from READ from WRITE setFrom NOTIFY fromChanged) Q_PROPERTY(QVector3D to READ to WRITE setTo NOTIFY toChanged) + QML_NAMED_ELEMENT(Vector3dAnimation) public: QQuickVector3dAnimation(QObject *parent=nullptr); @@ -389,6 +399,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickRotationAnimation : public QQuickPropertyAnim Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged) Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) Q_PROPERTY(RotationDirection direction READ direction WRITE setDirection NOTIFY directionChanged) + QML_NAMED_ELEMENT(RotationAnimation) public: QQuickRotationAnimation(QObject *parent=nullptr); @@ -433,6 +444,7 @@ class QQuickSequentialAnimation : public QQuickAnimationGroup { Q_OBJECT Q_DECLARE_PRIVATE(QQuickAnimationGroup) + QML_NAMED_ELEMENT(SequentialAnimation) public: QQuickSequentialAnimation(QObject *parent=nullptr); @@ -450,6 +462,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickParallelAnimation : public QQuickAnimationGro { Q_OBJECT Q_DECLARE_PRIVATE(QQuickAnimationGroup) + QML_NAMED_ELEMENT(ParallelAnimation) public: QQuickParallelAnimation(QObject *parent=nullptr); diff --git a/src/quick/util/qquickanimationcontroller_p.h b/src/quick/util/qquickanimationcontroller_p.h index d9ce377060..da6df6038a 100644 --- a/src/quick/util/qquickanimationcontroller_p.h +++ b/src/quick/util/qquickanimationcontroller_p.h @@ -64,6 +64,7 @@ class Q_AUTOTEST_EXPORT QQuickAnimationController : public QObject, public QQmlP Q_DECLARE_PRIVATE(QQuickAnimationController) Q_CLASSINFO("DefaultProperty", "animation") + QML_NAMED_ELEMENT(AnimationController) Q_PROPERTY(qreal progress READ progress WRITE setProgress NOTIFY progressChanged) Q_PROPERTY(QQuickAbstractAnimation *animation READ animation WRITE setAnimation NOTIFY animationChanged) diff --git a/src/quick/util/qquickanimator_p.h b/src/quick/util/qquickanimator_p.h index 511cecda7f..9f7aaafcb0 100644 --- a/src/quick/util/qquickanimator_p.h +++ b/src/quick/util/qquickanimator_p.h @@ -69,6 +69,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickAnimator : public QQuickAbstractAnimation Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged) + QML_NAMED_ELEMENT(Animator) + QML_ADDED_IN_MINOR_VERSION(2) + QML_UNCREATABLE("Animator is an abstract class") + public: QQuickItem *targetItem() const; void setTargetItem(QQuickItem *target); @@ -109,6 +113,8 @@ class QQuickScaleAnimatorPrivate; class Q_QUICK_PRIVATE_EXPORT QQuickScaleAnimator : public QQuickAnimator { Q_OBJECT + QML_NAMED_ELEMENT(ScaleAnimator) + QML_ADDED_IN_MINOR_VERSION(2) public: QQuickScaleAnimator(QObject *parent = nullptr); protected: @@ -119,6 +125,8 @@ protected: class Q_QUICK_PRIVATE_EXPORT QQuickXAnimator : public QQuickAnimator { Q_OBJECT + QML_NAMED_ELEMENT(XAnimator) + QML_ADDED_IN_MINOR_VERSION(2) public: QQuickXAnimator(QObject *parent = nullptr); protected: @@ -129,6 +137,8 @@ protected: class Q_QUICK_PRIVATE_EXPORT QQuickYAnimator : public QQuickAnimator { Q_OBJECT + QML_NAMED_ELEMENT(YAnimator) + QML_ADDED_IN_MINOR_VERSION(2) public: QQuickYAnimator(QObject *parent = nullptr); protected: @@ -139,6 +149,8 @@ protected: class Q_QUICK_PRIVATE_EXPORT QQuickOpacityAnimator : public QQuickAnimator { Q_OBJECT + QML_NAMED_ELEMENT(OpacityAnimator) + QML_ADDED_IN_MINOR_VERSION(2) public: QQuickOpacityAnimator(QObject *parent = nullptr); protected: @@ -152,6 +164,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickRotationAnimator : public QQuickAnimator Q_OBJECT Q_DECLARE_PRIVATE(QQuickRotationAnimator) Q_PROPERTY(RotationDirection direction READ direction WRITE setDirection NOTIFY directionChanged) + QML_NAMED_ELEMENT(RotationAnimator) + QML_ADDED_IN_MINOR_VERSION(2) public: enum RotationDirection { Numerical, Shortest, Clockwise, Counterclockwise }; @@ -177,6 +191,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickUniformAnimator : public QQuickAnimator Q_OBJECT Q_DECLARE_PRIVATE(QQuickUniformAnimator) Q_PROPERTY(QString uniform READ uniform WRITE setUniform NOTIFY uniformChanged) + QML_NAMED_ELEMENT(UniformAnimator) + QML_ADDED_IN_MINOR_VERSION(2) public: QQuickUniformAnimator(QObject *parent = nullptr); diff --git a/src/quick/util/qquickapplication_p.h b/src/quick/util/qquickapplication_p.h index 66a33489e4..b0eb6fa604 100644 --- a/src/quick/util/qquickapplication_p.h +++ b/src/quick/util/qquickapplication_p.h @@ -71,6 +71,9 @@ class Q_AUTOTEST_EXPORT QQuickApplication : public QQmlApplication Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName NOTIFY displayNameChanged) Q_PROPERTY(QQmlListProperty<QQuickScreenInfo> screens READ screens NOTIFY screensChanged) + QML_NAMED_ELEMENT(Application) + QML_UNCREATABLE("Application is an abstract class.") + public: explicit QQuickApplication(QObject *parent = nullptr); virtual ~QQuickApplication(); diff --git a/src/quick/util/qquickbehavior_p.h b/src/quick/util/qquickbehavior_p.h index 80a51d77af..fa9cf6d6bc 100644 --- a/src/quick/util/qquickbehavior_p.h +++ b/src/quick/util/qquickbehavior_p.h @@ -71,6 +71,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickBehavior : public QObject, public QQmlPropert Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) Q_PROPERTY(QVariant targetValue READ targetValue NOTIFY targetValueChanged REVISION 13) Q_CLASSINFO("DeferredPropertyNames", "animation") + QML_NAMED_ELEMENT(Behavior) public: QQuickBehavior(QObject *parent=nullptr); diff --git a/src/quick/util/qquickboundaryrule_p.h b/src/quick/util/qquickboundaryrule_p.h index 3325b675c5..d13031b173 100644 --- a/src/quick/util/qquickboundaryrule_p.h +++ b/src/quick/util/qquickboundaryrule_p.h @@ -77,6 +77,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickBoundaryRule : public QObject, public QQmlPro Q_PROPERTY(OvershootFilter overshootFilter READ overshootFilter WRITE setOvershootFilter NOTIFY overshootFilterChanged) Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged) Q_PROPERTY(int returnDuration READ returnDuration WRITE setReturnDuration NOTIFY returnDurationChanged) + QML_NAMED_ELEMENT(BoundaryRule) public: enum OvershootFilter { diff --git a/src/quick/util/qquickfontloader_p.h b/src/quick/util/qquickfontloader_p.h index 8d277f7cf7..e849c52a35 100644 --- a/src/quick/util/qquickfontloader_p.h +++ b/src/quick/util/qquickfontloader_p.h @@ -67,6 +67,7 @@ class Q_AUTOTEST_EXPORT QQuickFontLoader : public QObject Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(Status status READ status NOTIFY statusChanged) + QML_NAMED_ELEMENT(FontLoader) public: enum Status { Null = 0, Ready, Loading, Error }; diff --git a/src/quick/util/qquickfontmetrics_p.h b/src/quick/util/qquickfontmetrics_p.h index db2b7b6796..ee6d679649 100644 --- a/src/quick/util/qquickfontmetrics_p.h +++ b/src/quick/util/qquickfontmetrics_p.h @@ -79,6 +79,8 @@ class Q_AUTOTEST_EXPORT QQuickFontMetrics : public QObject Q_PROPERTY(qreal overlinePosition READ overlinePosition NOTIFY fontChanged) Q_PROPERTY(qreal strikeOutPosition READ strikeOutPosition NOTIFY fontChanged) Q_PROPERTY(qreal lineWidth READ lineWidth NOTIFY fontChanged) + QML_NAMED_ELEMENT(FontMetrics) + QML_ADDED_IN_MINOR_VERSION(4) public: explicit QQuickFontMetrics(QObject *parent = nullptr); ~QQuickFontMetrics(); diff --git a/src/quick/util/qquickforeignutils_p.h b/src/quick/util/qquickforeignutils_p.h new file mode 100644 index 0000000000..7e51bc4f82 --- /dev/null +++ b/src/quick/util/qquickforeignutils_p.h @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTQUICKFOREIGN_P_H +#define QTQUICKFOREIGN_P_H + +#include <qtquickglobal_p.h> + +#if QT_CONFIG(im) +#include <QtGui/qinputmethod.h> +#endif +#if QT_CONFIG(validator) +#include <QtGui/qvalidator.h> +#endif +#if QT_CONFIG(shortcut) +#include <QtGui/qkeysequence.h> +#endif + +#include <QtQml/qqml.h> + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +QT_BEGIN_NAMESPACE + +#if QT_CONFIG(validator) +struct QValidatorForeign +{ + Q_GADGET + QML_FOREIGN(QValidator) + QML_ANONYMOUS +}; + +struct QRegExpValidatorForeign +{ + Q_GADGET + QML_FOREIGN(QRegExpValidator) + QML_NAMED_ELEMENT(RegExpValidator) +}; + +#if QT_CONFIG(regularexpression) +struct QRegularExpressionValidatorForeign +{ + Q_GADGET + QML_FOREIGN(QRegularExpressionValidator) + QML_NAMED_ELEMENT(RegularExpressionValidator) + QML_ADDED_IN_MINOR_VERSION(14) +}; +#endif // QT_CONFIG(regularexpression) + +#endif // QT_CONFIG(validator) + +#if QT_CONFIG(im) +struct QInputMethodForeign +{ + Q_GADGET + QML_FOREIGN(QInputMethod) + QML_NAMED_ELEMENT(InputMethod) + QML_UNCREATABLE("InputMethod is an abstract class.") +}; +#endif // QT_CONFIG(im) + +#if QT_CONFIG(shortcut) +struct QKeySequenceForeign +{ + Q_GADGET + QML_FOREIGN(QKeySequence) + QML_NAMED_ELEMENT(StandardKey) + QML_ADDED_IN_MINOR_VERSION(2) + QML_UNCREATABLE("Cannot create an instance of StandardKey.") +}; +#endif // QT_CONFIG(shortcut) + +QT_END_NAMESPACE + +#endif // QTQUICKFOREIGN_P_H diff --git a/src/quick/util/qquickpath_p.h b/src/quick/util/qquickpath_p.h index 5987ae8f35..ca0495a90d 100644 --- a/src/quick/util/qquickpath_p.h +++ b/src/quick/util/qquickpath_p.h @@ -77,6 +77,7 @@ struct QQuickPathData class Q_QUICK_PRIVATE_EXPORT QQuickPathElement : public QObject { Q_OBJECT + QML_ANONYMOUS public: QQuickPathElement(QObject *parent=nullptr) : QObject(parent) {} Q_SIGNALS: @@ -89,6 +90,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathAttribute : public QQuickPathElement Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged) + QML_NAMED_ELEMENT(PathAttribute) public: QQuickPathAttribute(QObject *parent=nullptr) : QQuickPathElement(parent) {} @@ -116,6 +118,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickCurve : public QQuickPathElement Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged) Q_PROPERTY(qreal relativeX READ relativeX WRITE setRelativeX NOTIFY relativeXChanged) Q_PROPERTY(qreal relativeY READ relativeY WRITE setRelativeY NOTIFY relativeYChanged) + QML_ANONYMOUS public: QQuickCurve(QObject *parent=nullptr) : QQuickPathElement(parent) {} @@ -153,6 +156,7 @@ private: class Q_QUICK_PRIVATE_EXPORT QQuickPathLine : public QQuickCurve { Q_OBJECT + QML_NAMED_ELEMENT(PathLine) public: QQuickPathLine(QObject *parent=nullptr) : QQuickCurve(parent) {} @@ -162,6 +166,8 @@ public: class Q_QUICK_PRIVATE_EXPORT QQuickPathMove : public QQuickCurve { Q_OBJECT + QML_NAMED_ELEMENT(PathMove) + QML_ADDED_IN_MINOR_VERSION(9) public: QQuickPathMove(QObject *parent=nullptr) : QQuickCurve(parent) {} @@ -176,6 +182,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathQuad : public QQuickCurve Q_PROPERTY(qreal controlY READ controlY WRITE setControlY NOTIFY controlYChanged) Q_PROPERTY(qreal relativeControlX READ relativeControlX WRITE setRelativeControlX NOTIFY relativeControlXChanged) Q_PROPERTY(qreal relativeControlY READ relativeControlY WRITE setRelativeControlY NOTIFY relativeControlYChanged) + + QML_NAMED_ELEMENT(PathQuad) public: QQuickPathQuad(QObject *parent=nullptr) : QQuickCurve(parent) {} @@ -220,6 +228,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathCubic : public QQuickCurve Q_PROPERTY(qreal relativeControl1Y READ relativeControl1Y WRITE setRelativeControl1Y NOTIFY relativeControl1YChanged) Q_PROPERTY(qreal relativeControl2X READ relativeControl2X WRITE setRelativeControl2X NOTIFY relativeControl2XChanged) Q_PROPERTY(qreal relativeControl2Y READ relativeControl2Y WRITE setRelativeControl2Y NOTIFY relativeControl2YChanged) + QML_NAMED_ELEMENT(PathCubic) public: QQuickPathCubic(QObject *parent=nullptr) : QQuickCurve(parent) {} @@ -277,6 +286,7 @@ private: class Q_QUICK_PRIVATE_EXPORT QQuickPathCatmullRomCurve : public QQuickCurve { Q_OBJECT + QML_NAMED_ELEMENT(PathCurve) public: QQuickPathCatmullRomCurve(QObject *parent=nullptr) : QQuickCurve(parent) {} @@ -291,6 +301,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathArc : public QQuickCurve Q_PROPERTY(bool useLargeArc READ useLargeArc WRITE setUseLargeArc NOTIFY useLargeArcChanged) Q_PROPERTY(ArcDirection direction READ direction WRITE setDirection NOTIFY directionChanged) Q_PROPERTY(qreal xAxisRotation READ xAxisRotation WRITE setXAxisRotation NOTIFY xAxisRotationChanged REVISION 9) + QML_NAMED_ELEMENT(PathArc) public: QQuickPathArc(QObject *parent=nullptr) @@ -342,6 +353,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathAngleArc : public QQuickCurve Q_PROPERTY(qreal sweepAngle READ sweepAngle WRITE setSweepAngle NOTIFY sweepAngleChanged) Q_PROPERTY(bool moveToStart READ moveToStart WRITE setMoveToStart NOTIFY moveToStartChanged) + QML_NAMED_ELEMENT(PathAngleArc) + QML_ADDED_IN_MINOR_VERSION(11) + public: QQuickPathAngleArc(QObject *parent=nullptr) : QQuickCurve(parent) {} @@ -392,6 +406,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathSvg : public QQuickCurve { Q_OBJECT Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) + QML_NAMED_ELEMENT(PathSvg) public: QQuickPathSvg(QObject *parent=nullptr) : QQuickCurve(parent) {} @@ -411,6 +426,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathPercent : public QQuickPathElement { Q_OBJECT Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged) + QML_NAMED_ELEMENT(PathPercent) public: QQuickPathPercent(QObject *parent=nullptr) : QQuickPathElement(parent) {} @@ -429,6 +445,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathPolyline : public QQuickCurve Q_OBJECT Q_PROPERTY(QPointF start READ start NOTIFY startChanged) Q_PROPERTY(QVariant path READ path WRITE setPath NOTIFY pathChanged) + QML_NAMED_ELEMENT(PathPolyline) + QML_ADDED_IN_MINOR_VERSION(14) public: QQuickPathPolyline(QObject *parent=nullptr); @@ -451,6 +469,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathMultiline : public QQuickCurve Q_OBJECT Q_PROPERTY(QPointF start READ start NOTIFY startChanged) Q_PROPERTY(QVariant paths READ paths WRITE setPaths NOTIFY pathsChanged) + QML_NAMED_ELEMENT(PathMultiline) + QML_ADDED_IN_MINOR_VERSION(14) public: QQuickPathMultiline(QObject *parent=nullptr); @@ -493,6 +513,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPath : public QObject, public QQmlParserStatu Q_PROPERTY(bool closed READ isClosed NOTIFY changed) Q_PROPERTY(QSizeF scale READ scale WRITE setScale NOTIFY scaleChanged REVISION 14) Q_CLASSINFO("DefaultProperty", "pathElements") + QML_NAMED_ELEMENT(Path) Q_INTERFACES(QQmlParserStatus) public: QQuickPath(QObject *parent=nullptr); diff --git a/src/quick/util/qquickpathinterpolator_p.h b/src/quick/util/qquickpathinterpolator_p.h index 60a9ff2e22..440ea06841 100644 --- a/src/quick/util/qquickpathinterpolator_p.h +++ b/src/quick/util/qquickpathinterpolator_p.h @@ -69,6 +69,7 @@ class Q_AUTOTEST_EXPORT QQuickPathInterpolator : public QObject Q_PROPERTY(qreal x READ x NOTIFY xChanged) Q_PROPERTY(qreal y READ y NOTIFY yChanged) Q_PROPERTY(qreal angle READ angle NOTIFY angleChanged) + QML_NAMED_ELEMENT(PathInterpolator) public: explicit QQuickPathInterpolator(QObject *parent = nullptr); diff --git a/src/quick/util/qquickpropertychanges_p.h b/src/quick/util/qquickpropertychanges_p.h index 82a6ebffac..27a00420af 100644 --- a/src/quick/util/qquickpropertychanges_p.h +++ b/src/quick/util/qquickpropertychanges_p.h @@ -65,6 +65,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPropertyChanges : public QQuickStateOperation Q_PROPERTY(QObject *target READ object WRITE setObject) Q_PROPERTY(bool restoreEntryValues READ restoreEntryValues WRITE setRestoreEntryValues) Q_PROPERTY(bool explicit READ isExplicit WRITE setIsExplicit) + QML_NAMED_ELEMENT(PropertyChanges) + public: QQuickPropertyChanges(); ~QQuickPropertyChanges(); @@ -107,6 +109,11 @@ public: void applyBindings(QObject *obj, const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) override; }; +template<> +inline QQmlCustomParser *qmlCreateCustomParser<QQuickPropertyChanges>() +{ + return new QQuickPropertyChangesParser; +} QT_END_NAMESPACE diff --git a/src/quick/util/qquickshortcut_p.h b/src/quick/util/qquickshortcut_p.h index 712cca7696..0e66a38e75 100644 --- a/src/quick/util/qquickshortcut_p.h +++ b/src/quick/util/qquickshortcut_p.h @@ -56,6 +56,7 @@ #include <QtCore/qvariant.h> #include <QtGui/qkeysequence.h> #include <QtQml/qqmlparserstatus.h> +#include <QtQml/qqml.h> QT_BEGIN_NAMESPACE @@ -72,6 +73,8 @@ class QQuickShortcut : public QObject, public QQmlParserStatus Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL) Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL) Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext NOTIFY contextChanged FINAL) + QML_NAMED_ELEMENT(Shortcut) + QML_ADDED_IN_MINOR_VERSION(5) public: explicit QQuickShortcut(QObject *parent = nullptr); diff --git a/src/quick/util/qquicksmoothedanimation_p.h b/src/quick/util/qquicksmoothedanimation_p.h index 7bceba387c..d7e637446d 100644 --- a/src/quick/util/qquicksmoothedanimation_p.h +++ b/src/quick/util/qquicksmoothedanimation_p.h @@ -68,6 +68,7 @@ class Q_AUTOTEST_EXPORT QQuickSmoothedAnimation : public QQuickNumberAnimation Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity NOTIFY velocityChanged) Q_PROPERTY(ReversingMode reversingMode READ reversingMode WRITE setReversingMode NOTIFY reversingModeChanged) Q_PROPERTY(qreal maximumEasingTime READ maximumEasingTime WRITE setMaximumEasingTime NOTIFY maximumEasingTimeChanged) + QML_NAMED_ELEMENT(SmoothedAnimation) public: enum ReversingMode { Eased, Immediate, Sync }; diff --git a/src/quick/util/qquickspringanimation_p.h b/src/quick/util/qquickspringanimation_p.h index 2014a4311a..771b746622 100644 --- a/src/quick/util/qquickspringanimation_p.h +++ b/src/quick/util/qquickspringanimation_p.h @@ -71,6 +71,7 @@ class Q_AUTOTEST_EXPORT QQuickSpringAnimation : public QQuickNumberAnimation Q_PROPERTY(qreal epsilon READ epsilon WRITE setEpsilon) Q_PROPERTY(qreal modulus READ modulus WRITE setModulus NOTIFY modulusChanged) Q_PROPERTY(qreal mass READ mass WRITE setMass NOTIFY massChanged) + QML_NAMED_ELEMENT(SpringAnimation) public: QQuickSpringAnimation(QObject *parent=nullptr); diff --git a/src/quick/util/qquickstate_p.h b/src/quick/util/qquickstate_p.h index 576ba9834c..af49bb1c2f 100644 --- a/src/quick/util/qquickstate_p.h +++ b/src/quick/util/qquickstate_p.h @@ -125,6 +125,7 @@ class QQuickStateOperationPrivate; class Q_QUICK_PRIVATE_EXPORT QQuickStateOperation : public QObject { Q_OBJECT + QML_ANONYMOUS public: QQuickStateOperation(QObject *parent = nullptr) : QObject(parent) {} @@ -157,6 +158,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickState : public QObject Q_PROPERTY(QQmlListProperty<QQuickStateOperation> changes READ changes) Q_CLASSINFO("DefaultProperty", "changes") Q_CLASSINFO("DeferredPropertyNames", "changes") + QML_NAMED_ELEMENT(State) public: QQuickState(QObject *parent=nullptr); diff --git a/src/quick/util/qquickstatechangescript_p.h b/src/quick/util/qquickstatechangescript_p.h index ff509a7cf5..931baaca4e 100644 --- a/src/quick/util/qquickstatechangescript_p.h +++ b/src/quick/util/qquickstatechangescript_p.h @@ -64,6 +64,7 @@ class Q_AUTOTEST_EXPORT QQuickStateChangeScript : public QQuickStateOperation, p Q_PROPERTY(QQmlScriptString script READ script WRITE setScript) Q_PROPERTY(QString name READ name WRITE setName) + QML_NAMED_ELEMENT(StateChangeScript) public: QQuickStateChangeScript(QObject *parent=nullptr); diff --git a/src/quick/util/qquickstategroup_p.h b/src/quick/util/qquickstategroup_p.h index 7235066d99..11a0c5f442 100644 --- a/src/quick/util/qquickstategroup_p.h +++ b/src/quick/util/qquickstategroup_p.h @@ -65,6 +65,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickStateGroup : public QObject, public QQmlParse Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged) Q_PROPERTY(QQmlListProperty<QQuickState> states READ statesProperty DESIGNABLE false) Q_PROPERTY(QQmlListProperty<QQuickTransition> transitions READ transitionsProperty DESIGNABLE false) + QML_NAMED_ELEMENT(StateGroup) public: QQuickStateGroup(QObject * = nullptr); diff --git a/src/quick/util/qquicksystempalette_p.h b/src/quick/util/qquicksystempalette_p.h index 9a3a520ed1..c6d9fc2604 100644 --- a/src/quick/util/qquicksystempalette_p.h +++ b/src/quick/util/qquicksystempalette_p.h @@ -79,6 +79,7 @@ class Q_AUTOTEST_EXPORT QQuickSystemPalette : public QObject Q_PROPERTY(QColor shadow READ shadow NOTIFY paletteChanged) Q_PROPERTY(QColor highlight READ highlight NOTIFY paletteChanged) Q_PROPERTY(QColor highlightedText READ highlightedText NOTIFY paletteChanged) + QML_NAMED_ELEMENT(SystemPalette) public: QQuickSystemPalette(QObject *parent=nullptr); diff --git a/src/quick/util/qquicktextmetrics_p.h b/src/quick/util/qquicktextmetrics_p.h index 4fb6741996..a1d64e3d0a 100644 --- a/src/quick/util/qquicktextmetrics_p.h +++ b/src/quick/util/qquicktextmetrics_p.h @@ -74,6 +74,8 @@ class Q_AUTOTEST_EXPORT QQuickTextMetrics : public QObject Q_PROPERTY(QString elidedText READ elidedText NOTIFY metricsChanged FINAL) Q_PROPERTY(Qt::TextElideMode elide READ elide WRITE setElide NOTIFY elideChanged FINAL) Q_PROPERTY(qreal elideWidth READ elideWidth WRITE setElideWidth NOTIFY elideWidthChanged FINAL) + QML_NAMED_ELEMENT(TextMetrics) + QML_ADDED_IN_MINOR_VERSION(4) public: explicit QQuickTextMetrics(QObject *parent = 0); diff --git a/src/quick/util/qquicktransition_p.h b/src/quick/util/qquicktransition_p.h index c7d06b8832..6e45143126 100644 --- a/src/quick/util/qquicktransition_p.h +++ b/src/quick/util/qquicktransition_p.h @@ -103,6 +103,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTransition : public QObject Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) Q_CLASSINFO("DefaultProperty", "animations") Q_CLASSINFO("DeferredPropertyNames", "animations") + QML_NAMED_ELEMENT(Transition) public: QQuickTransition(QObject *parent=nullptr); diff --git a/src/quick/util/qquickutilmodule.cpp b/src/quick/util/qquickutilmodule.cpp index 93b6599506..650a8c7e81 100644 --- a/src/quick/util/qquickutilmodule.cpp +++ b/src/quick/util/qquickutilmodule.cpp @@ -40,6 +40,7 @@ #include "qquickutilmodule_p.h" #include "qquickanimation_p.h" #include "qquickanimation_p_p.h" +#include "qquickapplication_p.h" #include "qquickbehavior_p.h" #include "qquicksmoothedanimation_p.h" #include "qquickfontloader_p.h" @@ -58,12 +59,11 @@ #include "qquickshortcut_p.h" #endif #include "qquickvalidator_p.h" +#include "qquickforeignutils_p.h" #include <qqmlinfo.h> #include <private/qqmltypenotavailable_p.h> #include <private/qquickanimationcontroller_p.h> #include <QtCore/qcoreapplication.h> -#include <QtGui/QInputMethod> -#include <QtGui/QKeySequence> #if QT_CONFIG(shortcut) Q_DECLARE_METATYPE(QKeySequence::StandardKey) @@ -71,73 +71,61 @@ Q_DECLARE_METATYPE(QKeySequence::StandardKey) void QQuickUtilModule::defineModule() { -#if QT_CONFIG(im) - qmlRegisterUncreatableType<QInputMethod>("QtQuick",2,0,"InputMethod", - QInputMethod::tr("InputMethod is an abstract class")); +#if QT_CONFIG(shortcut) + qRegisterMetaType<QKeySequence::StandardKey>(); #endif - qmlRegisterUncreatableType<QQuickAbstractAnimation>("QtQuick",2,0,"Animation",QQuickAbstractAnimation::tr("Animation is an abstract class")); - - qmlRegisterType<QQuickBehavior>("QtQuick",2,0,"Behavior"); - qmlRegisterType<QQuickColorAnimation>("QtQuick",2,0,"ColorAnimation"); - qmlRegisterType<QQuickSmoothedAnimation>("QtQuick",2,0,"SmoothedAnimation"); - qmlRegisterType<QQuickFontLoader>("QtQuick",2,0,"FontLoader"); - qmlRegisterType<QQuickNumberAnimation>("QtQuick",2,0,"NumberAnimation"); - qmlRegisterType<QQuickParallelAnimation>("QtQuick",2,0,"ParallelAnimation"); - qmlRegisterType<QQuickPauseAnimation>("QtQuick",2,0,"PauseAnimation"); - qmlRegisterType<QQuickPropertyAction>("QtQuick",2,0,"PropertyAction"); - qmlRegisterType<QQuickPropertyAnimation>("QtQuick",2,0,"PropertyAnimation"); - qmlRegisterType<QQuickRotationAnimation>("QtQuick",2,0,"RotationAnimation"); - qmlRegisterType<QQuickScriptAction>("QtQuick",2,0,"ScriptAction"); - qmlRegisterType<QQuickSequentialAnimation>("QtQuick",2,0,"SequentialAnimation"); - qmlRegisterType<QQuickSpringAnimation>("QtQuick",2,0,"SpringAnimation"); - qmlRegisterType<QQuickAnimationController>("QtQuick",2,0,"AnimationController"); - qmlRegisterType<QQuickStateChangeScript>("QtQuick",2,0,"StateChangeScript"); - qmlRegisterType<QQuickStateGroup>("QtQuick",2,0,"StateGroup"); - qmlRegisterType<QQuickState>("QtQuick",2,0,"State"); - qmlRegisterType<QQuickSystemPalette>("QtQuick",2,0,"SystemPalette"); - qmlRegisterType<QQuickTransition>("QtQuick",2,0,"Transition"); - qmlRegisterType<QQuickVector3dAnimation>("QtQuick",2,0,"Vector3dAnimation"); + qmlRegisterTypesAndRevisions< #if QT_CONFIG(validator) - qmlRegisterAnonymousType<QValidator>("QtQuick", 2); - qmlRegisterType<QQuickIntValidator>("QtQuick",2,0,"IntValidator"); - qmlRegisterType<QQuickDoubleValidator>("QtQuick",2,0,"DoubleValidator"); - qmlRegisterType<QRegExpValidator>("QtQuick",2,0,"RegExpValidator"); + QValidatorForeign, + QQuickIntValidator, + QQuickDoubleValidator, + QRegExpValidatorForeign, #if QT_CONFIG(regularexpression) - qmlRegisterType<QRegularExpressionValidator>("QtQuick", 2, 14, "RegularExpressionValidator"); -#endif -#endif - - qmlRegisterUncreatableType<QQuickAnimator>("QtQuick", 2, 2, "Animator", QQuickAbstractAnimation::tr("Animator is an abstract class")); - qmlRegisterType<QQuickXAnimator>("QtQuick", 2, 2, "XAnimator"); - qmlRegisterType<QQuickYAnimator>("QtQuick", 2, 2, "YAnimator"); - qmlRegisterType<QQuickScaleAnimator>("QtQuick", 2, 2, "ScaleAnimator"); - qmlRegisterType<QQuickRotationAnimator>("QtQuick", 2, 2, "RotationAnimator"); - qmlRegisterType<QQuickOpacityAnimator>("QtQuick", 2, 2, "OpacityAnimator"); + QRegularExpressionValidatorForeign, +#endif // QT_CONFIG(regularexpression) +#endif // QT_CONFIG(validator) #if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) - qmlRegisterType<QQuickUniformAnimator>("QtQuick", 2, 2, "UniformAnimator"); + QQuickUniformAnimator, #endif - qmlRegisterAnonymousType<QQuickStateOperation>("QtQuick", 2); - - qmlRegisterCustomType<QQuickPropertyChanges>("QtQuick",2,0,"PropertyChanges", new QQuickPropertyChangesParser); - #if QT_CONFIG(shortcut) - qRegisterMetaType<QKeySequence::StandardKey>(); - qmlRegisterUncreatableType<QKeySequence, 2>("QtQuick", 2, 2, "StandardKey", QStringLiteral("Cannot create an instance of StandardKey.")); + QQuickShortcut, + QKeySequenceForeign, #endif - - qmlRegisterType<QQuickFontMetrics>("QtQuick", 2, 4, "FontMetrics"); - qmlRegisterType<QQuickTextMetrics>("QtQuick", 2, 4, "TextMetrics"); - -#if QT_CONFIG(shortcut) - qmlRegisterType<QQuickShortcut>("QtQuick", 2, 5, "Shortcut"); - qmlRegisterType<QQuickShortcut,6>("QtQuick", 2, 6, "Shortcut"); - - qmlRegisterType<QQuickShortcut,9>("QtQuick", 2, 9, "Shortcut"); +#if QT_CONFIG(im) + QInputMethodForeign, #endif - - qmlRegisterUncreatableType<QQuickAbstractAnimation, 12>("QtQuick", 2, 12, "Animation", - QQuickAbstractAnimation::tr("Animation is an abstract class")); - // 5.13 - qmlRegisterType<QQuickBehavior, 13>("QtQuick", 2, 13, "Behavior"); + QQuickAbstractAnimation, + QQuickBehavior, + QQuickColorAnimation, + QQuickSmoothedAnimation, + QQuickFontLoader, + QQuickNumberAnimation, + QQuickParallelAnimation, + QQuickPauseAnimation, + QQuickPropertyAction, + QQuickPropertyAnimation, + QQuickRotationAnimation, + QQuickScriptAction, + QQuickSequentialAnimation, + QQuickSpringAnimation, + QQuickAnimationController, + QQuickStateChangeScript, + QQuickStateGroup, + QQuickState, + QQuickSystemPalette, + QQuickTransition, + QQuickVector3dAnimation, + QQuickAnimator, + QQuickXAnimator, + QQuickYAnimator, + QQuickScaleAnimator, + QQuickRotationAnimator, + QQuickOpacityAnimator, + QQuickStateOperation, + QQuickPropertyChanges, + QQuickFontMetrics, + QQuickTextMetrics, + QQuickApplication + >("QtQuick", 2); } diff --git a/src/quick/util/qquickvalidator_p.h b/src/quick/util/qquickvalidator_p.h index 9212efa044..a0dc2cd5ba 100644 --- a/src/quick/util/qquickvalidator_p.h +++ b/src/quick/util/qquickvalidator_p.h @@ -61,6 +61,7 @@ class Q_AUTOTEST_EXPORT QQuickIntValidator : public QIntValidator { Q_OBJECT Q_PROPERTY(QString locale READ localeName WRITE setLocaleName RESET resetLocaleName NOTIFY localeNameChanged) + QML_NAMED_ELEMENT(IntValidator) public: QQuickIntValidator(QObject *parent = nullptr); @@ -76,6 +77,7 @@ class Q_AUTOTEST_EXPORT QQuickDoubleValidator : public QDoubleValidator { Q_OBJECT Q_PROPERTY(QString locale READ localeName WRITE setLocaleName RESET resetLocaleName NOTIFY localeNameChanged) + QML_NAMED_ELEMENT(DoubleValidator) public: QQuickDoubleValidator(QObject *parent = nullptr); diff --git a/src/quick/util/qquickvaluetypes_p.h b/src/quick/util/qquickvaluetypes_p.h index 5a9af970e8..25fac72a38 100644 --- a/src/quick/util/qquickvaluetypes_p.h +++ b/src/quick/util/qquickvaluetypes_p.h @@ -326,6 +326,9 @@ class QQuickFontValueType Q_PROPERTY(bool kerning READ kerning WRITE setKerning FINAL) Q_PROPERTY(bool preferShaping READ preferShaping WRITE setPreferShaping FINAL) + QML_NAMED_ELEMENT(Font) + QML_UNCREATABLE("Element is not creatable.") + public: enum FontWeight { Thin = QFont::Thin, ExtraLight = QFont::ExtraLight, diff --git a/src/quick/util/util.pri b/src/quick/util/util.pri index 63d995e34c..ae06f7a7fe 100644 --- a/src/quick/util/util.pri +++ b/src/quick/util/util.pri @@ -65,7 +65,8 @@ HEADERS += \ $$PWD/qquickprofiler_p.h \ $$PWD/qquickfontmetrics_p.h \ $$PWD/qquicktextmetrics_p.h \ - $$PWD/qquickvalidator_p.h + $$PWD/qquickvalidator_p.h \ + $$PWD/qquickforeignutils_p.h qtConfig(shortcut) { SOURCES += \ diff --git a/src/quickshapes/qquickshape_p.h b/src/quickshapes/qquickshape_p.h index 7066ea0709..cadc65f7cd 100644 --- a/src/quickshapes/qquickshape_p.h +++ b/src/quickshapes/qquickshape_p.h @@ -69,6 +69,9 @@ class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapeGradient : public QQuickGradient Q_PROPERTY(SpreadMode spread READ spread WRITE setSpread NOTIFY spreadChanged) Q_CLASSINFO("DefaultProperty", "stops") + QML_NAMED_ELEMENT(ShapeGradient) + QML_UNCREATABLE("ShapeGradient is an abstract base class."); + public: enum SpreadMode { PadSpread, @@ -97,6 +100,7 @@ class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapeLinearGradient : public QQuickShap Q_PROPERTY(qreal x2 READ x2 WRITE setX2 NOTIFY x2Changed) Q_PROPERTY(qreal y2 READ y2 WRITE setY2 NOTIFY y2Changed) Q_CLASSINFO("DefaultProperty", "stops") + QML_NAMED_ELEMENT(LinearGradient) public: QQuickShapeLinearGradient(QObject *parent = nullptr); @@ -131,6 +135,7 @@ class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapeRadialGradient : public QQuickShap Q_PROPERTY(qreal focalY READ focalY WRITE setFocalY NOTIFY focalYChanged) Q_PROPERTY(qreal focalRadius READ focalRadius WRITE setFocalRadius NOTIFY focalRadiusChanged) Q_CLASSINFO("DefaultProperty", "stops") + QML_NAMED_ELEMENT(RadialGradient) public: QQuickShapeRadialGradient(QObject *parent = nullptr); @@ -175,6 +180,7 @@ class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapeConicalGradient : public QQuickSha Q_PROPERTY(qreal centerY READ centerY WRITE setCenterY NOTIFY centerYChanged) Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged) Q_CLASSINFO("DefaultProperty", "stops") + QML_NAMED_ELEMENT(ConicalGradient) public: QQuickShapeConicalGradient(QObject *parent = nullptr); @@ -214,6 +220,7 @@ class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapePath : public QQuickPath Q_PROPERTY(QVector<qreal> dashPattern READ dashPattern WRITE setDashPattern NOTIFY dashPatternChanged) Q_PROPERTY(QQuickShapeGradient *fillGradient READ fillGradient WRITE setFillGradient RESET resetFillGradient) Q_PROPERTY(QSizeF scale READ scale WRITE setScale NOTIFY scaleChanged REVISION 14) + QML_NAMED_ELEMENT(ShapePath) public: enum FillRule { @@ -308,6 +315,7 @@ class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShape : public QQuickItem Q_PROPERTY(ContainsMode containsMode READ containsMode WRITE setContainsMode NOTIFY containsModeChanged REVISION 11) Q_PROPERTY(QQmlListProperty<QObject> data READ data) Q_CLASSINFO("DefaultProperty", "data") + QML_NAMED_ELEMENT(Shape) public: enum RendererType { |