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/handlers | |
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/handlers')
-rw-r--r-- | src/quick/handlers/qquickdragaxis_p.h | 4 | ||||
-rw-r--r-- | src/quick/handlers/qquickdraghandler_p.h | 2 | ||||
-rw-r--r-- | src/quick/handlers/qquickhoverhandler_p.h | 2 | ||||
-rw-r--r-- | src/quick/handlers/qquickpinchhandler_p.h | 2 | ||||
-rw-r--r-- | src/quick/handlers/qquickpointerhandler_p.h | 4 | ||||
-rw-r--r-- | src/quick/handlers/qquickpointhandler_p.h | 2 | ||||
-rw-r--r-- | src/quick/handlers/qquicktaphandler_p.h | 3 | ||||
-rw-r--r-- | src/quick/handlers/qquickwheelhandler_p.h | 3 |
8 files changed, 22 insertions, 0 deletions
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); |