diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-08-21 18:34:21 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-09-26 12:32:17 +0200 |
commit | cc1a604c704f848927b3fa0a97b0a50b0b79d2a4 (patch) | |
tree | 610ece713eba021c8e5a3d248f54a62370e810f8 /src/quick/items/qquickitem_p.h | |
parent | 531cf90305ae50920b2e597dd0758fdb82ad88b0 (diff) |
Specify parameters of type registration in class declarations
Using this technique we can automatically register all necessary
revisions and minor versions of a type, using the metaobject system.
This greatly reduces the potential for mistakes and resulting
incompatibilities between versions of imports.
We assume that for each type we need to register all revisions of its
super types and its attached type, and that the revisions match. That
is, if you import version X of type A, you will also get version X of
its attached type and of any super types. As we previously didn't take
these dependencies into account when manually registering the types, a
number of extra revisions are now registered for some types.
Potentially, we can now generate the qmltypes files at compile time,
using moc.
Change-Id: I7abb8a5c39f5e63ad1a0cb41a783f2c91909491b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/quick/items/qquickitem_p.h')
-rw-r--r-- | src/quick/items/qquickitem_p.h | 22 |
1 files changed, 18 insertions, 4 deletions
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 |