aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/handlers/qquickdraghandler_p.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2019-05-28 17:59:34 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2019-05-28 17:59:40 +0200
commit1f3c157ec6b8be5de1eb89295713c2980fb1a7aa (patch)
treeb85888d73518f6abc7bbde74ab71a27887682f9d /src/quick/handlers/qquickdraghandler_p.h
parent44ca7e31ee9365a72cd17ecd335ec4d0161420a9 (diff)
parent0f5c34f2c6b64bae3429706a6c4211334c689092 (diff)
Merge "Merge remote-tracking branch 'origin/dev' into wip/scenegraphng"wip/scenegraphng
Diffstat (limited to 'src/quick/handlers/qquickdraghandler_p.h')
-rw-r--r--src/quick/handlers/qquickdraghandler_p.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/quick/handlers/qquickdraghandler_p.h b/src/quick/handlers/qquickdraghandler_p.h
index 748026488a..18c1fd841d 100644
--- a/src/quick/handlers/qquickdraghandler_p.h
+++ b/src/quick/handlers/qquickdraghandler_p.h
@@ -62,8 +62,17 @@ class Q_QUICK_PRIVATE_EXPORT QQuickDragHandler : public QQuickMultiPointHandler
Q_PROPERTY(QQuickDragAxis * xAxis READ xAxis CONSTANT)
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)
public:
+ enum SnapMode {
+ NoSnap = 0,
+ SnapAuto,
+ SnapIfPressedOutsideTarget,
+ SnapAlways
+ };
+ Q_ENUM(SnapMode)
+
explicit QQuickDragHandler(QQuickItem *parent = nullptr);
void handlePointerEventImpl(QQuickPointerEvent *event) override;
@@ -73,11 +82,14 @@ public:
QVector2D translation() const { return m_translation; }
void setTranslation(const QVector2D &trans);
+ QQuickDragHandler::SnapMode snapMode() const;
+ void setSnapMode(QQuickDragHandler::SnapMode mode);
void enforceConstraints();
Q_SIGNALS:
void translationChanged();
+ void snapModeChanged();
protected:
void onActiveChanged() override;
@@ -97,6 +109,7 @@ private:
QQuickDragAxis m_xAxis;
QQuickDragAxis m_yAxis;
+ QQuickDragHandler::SnapMode m_snapMode = SnapAuto;
bool m_pressedInsideTarget = false;
friend class QQuickDragAxis;