From 2b10e11a95963d444e8f329eca6c29eeb38573d0 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 19 Jul 2018 10:56:19 +0200 Subject: TapHandler: enforce drag threshold for timeHeld and longPressed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/quick/handlers/qquicktaphandler.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/quick/handlers/qquicktaphandler.cpp') 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); -- cgit v1.2.3