aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/handlers/qquickdraghandler_p.h
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@qt.io>2016-12-23 15:35:43 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2016-12-29 15:13:08 +0000
commit9aa0e84d974d86cf9366714107e9c84dcde15490 (patch)
tree71247c93da66322cceca7ab1d62c3bedaee77458 /src/quick/handlers/qquickdraghandler_p.h
parentde3896d2ee2a57aad83eea237ef1c39e3581190b (diff)
Add a DragHandler::translation property
This allows the application developer to get the translation of the dragged pointer, and apply it in a custom way. This should usually be combined with setting target to null. This will for instance be needed when we want to drag QtLocations map, where a map is dragged by specifying the geo location of the center of the map. The map2.qml example demonstrates this. Change-Id: I652d9fc92fa9b6dfd3796c7147832f25af0cc5bc Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/handlers/qquickdraghandler_p.h')
-rw-r--r--src/quick/handlers/qquickdraghandler_p.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/quick/handlers/qquickdraghandler_p.h b/src/quick/handlers/qquickdraghandler_p.h
index 8f27d51b4f..69fa297b3c 100644
--- a/src/quick/handlers/qquickdraghandler_p.h
+++ b/src/quick/handlers/qquickdraghandler_p.h
@@ -90,6 +90,7 @@ class Q_AUTOTEST_EXPORT QQuickDragHandler : public QQuickPointerSingleHandler
Q_OBJECT
Q_PROPERTY(QQuickDragAxis * xAxis READ xAxis CONSTANT)
Q_PROPERTY(QQuickDragAxis * yAxis READ yAxis CONSTANT)
+ Q_PROPERTY(QPointF translation READ translation NOTIFY translationChanged)
public:
QQuickDragHandler(QObject *parent = 0);
@@ -100,10 +101,14 @@ public:
QQuickDragAxis *xAxis() { return &m_xAxis; }
QQuickDragAxis *yAxis() { return &m_yAxis; }
+ QPointF translation() const { return m_translation; }
+ void setTranslation(const QPointF &trans);
+
Q_INVOKABLE void enforceConstraints();
Q_SIGNALS:
// void gestureStarted(QQuickGestureEvent *gesture);
+ void translationChanged();
protected:
bool wantsEventPoint(QQuickEventPoint *point) override;
@@ -114,6 +119,7 @@ private:
private:
QPointF m_startPos;
+ QPointF m_translation;
QQuickDragAxis m_xAxis;
QQuickDragAxis m_yAxis;