diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-07-19 10:56:19 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-07-19 12:42:10 +0000 |
commit | 2b10e11a95963d444e8f329eca6c29eeb38573d0 (patch) | |
tree | 9baa7cd8cd2a3a566e7408d29219e73384627ecd /src/quick/handlers/qquicktaphandler.cpp | |
parent | 888e191ec80a9df2c1ad5eea7fab25692e3a33fa (diff) |
TapHandler: enforce drag threshold for timeHeld and longPressed
As the docs say, timeHeld is the amount of time that a pressed point
has been held, without moving beyond the drag threshold. Likewise
the longPressed signal should not be omitted if the point has moved
beyond the drag threshold. In typical interactions these are relevant
for long-pressing in one place, not while moving around.
Task-number: QTBUG-65012
Change-Id: I3236def5de4d70f8d174362972a76e680452f018
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/handlers/qquicktaphandler.cpp')
-rw-r--r-- | src/quick/handlers/qquicktaphandler.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp index 255059b9bd..b88c028977 100644 --- a/src/quick/handlers/qquicktaphandler.cpp +++ b/src/quick/handlers/qquicktaphandler.cpp @@ -121,6 +121,11 @@ bool QQuickTapHandler::wantsEventPoint(QQuickEventPoint *point) // (e.g. DragHandler) gets a chance to take over. // Don't forget to emit released in case of a cancel. bool ret = false; + bool overThreshold = dragOverThreshold(point); + if (overThreshold) { + m_longPressTimer.stop(); + m_holdTimer.invalidate(); + } switch (point->state()) { case QQuickEventPoint::Pressed: case QQuickEventPoint::Released: @@ -129,7 +134,7 @@ bool QQuickTapHandler::wantsEventPoint(QQuickEventPoint *point) case QQuickEventPoint::Updated: switch (m_gesturePolicy) { case DragThreshold: - ret = !dragOverThreshold(point); + ret = !overThreshold; break; case WithinBounds: ret = parentContains(point); |