diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-08-22 14:57:02 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-08-26 13:05:12 +0000 |
commit | d0922fcd0ac6707a46cbfd8422aeee5e36a49202 (patch) | |
tree | 0342abb9eb7bea823d89e7a174b2cfb2d3baded3 /src | |
parent | 31e757ad30f415a0e106b436388ed9a5aae1d177 (diff) |
add QQuickEventPoint::scenePressPos property
It's important for some handlers to track the total movement so far.
Change-Id: If729c48731725aa035c32d203d719ea80df83078
Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquickevents.cpp | 4 | ||||
-rw-r--r-- | src/quick/items/qquickevents_p_p.h | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index e9d9631ed5..619ec455ff 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -521,8 +521,10 @@ void QQuickEventPoint::reset(Qt::TouchPointState state, const QPointF &scenePos, m_accept = false; m_state = static_cast<QQuickEventPoint::State>(state); m_timestamp = timestamp; - if (state == Qt::TouchPointPressed) + if (state == Qt::TouchPointPressed) { m_pressTimestamp = timestamp; + m_scenePressPos = scenePos; + } // TODO if Q_LIKELY(velocity.isNull) calculate velocity m_velocity = velocity; } diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h index e50819ae61..5e663a4680 100644 --- a/src/quick/items/qquickevents_p_p.h +++ b/src/quick/items/qquickevents_p_p.h @@ -251,6 +251,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickEventPoint : public QObject { Q_OBJECT Q_PROPERTY(QPointF scenePos READ scenePos) + Q_PROPERTY(QPointF scenePressPos READ scenePressPos) Q_PROPERTY(QVector2D velocity READ velocity) Q_PROPERTY(State state READ state) Q_PROPERTY(quint64 pointId READ pointId) @@ -276,6 +277,7 @@ public: QQuickPointerEvent *pointerEvent() const; QPointF scenePos() const { return m_scenePos; } + QPointF scenePressPos() const { return m_scenePressPos; } QVector2D velocity() const { return m_velocity; } State state() const { return m_state; } quint64 pointId() const { return m_pointId; } @@ -294,6 +296,7 @@ public: private: QPointF m_scenePos; + QPointF m_scenePressPos; QVector2D m_velocity; quint64 m_pointId; QPointer<QObject> m_grabber; |