diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-08-26 16:39:22 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-09-19 07:44:05 +0000 |
commit | b9a80c04b52a38ae2f24998e6b58a67bb20d8941 (patch) | |
tree | 4a4fa8cd7ccc7f22ff9fd004aade26b84add09c8 | |
parent | c364b935f06256ec7adfaf486ef35b3996152804 (diff) |
QQuickEventPoint::invalidate(): set m_pointId to zero
One reason is that if event->pointById(someKnownId) returns true,
a handler may assume that the point is still valid. So either
pointById needs to check the valid flag, or we must reset the
pointId so that it won't be found.
Change-Id: I20e93f058737a77ed801f0148ab7525ab880902d
Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
-rw-r--r-- | src/quick/items/qquickevents.cpp | 6 | ||||
-rw-r--r-- | src/quick/items/qquickevents_p_p.h | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index f4b203ac53..4bb591fae3 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -537,6 +537,12 @@ void QQuickEventPoint::localize(QQuickItem *target) m_pos = QPointF(); } +void QQuickEventPoint::invalidate() +{ + m_valid = false; + m_pointId = 0; +} + QObject *QQuickEventPoint::grabber() const { return m_grabber.data(); diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h index 1c524e9e3b..132246f59b 100644 --- a/src/quick/items/qquickevents_p_p.h +++ b/src/quick/items/qquickevents_p_p.h @@ -276,7 +276,7 @@ public: void reset(Qt::TouchPointState state, const QPointF &scenePos, quint64 pointId, ulong timestamp, const QVector2D &velocity = QVector2D()); void localize(QQuickItem *target); - void invalidate() { m_valid = false; } + void invalidate(); QQuickPointerEvent *pointerEvent() const; QPointF pos() const { return m_pos; } |