diff options
Diffstat (limited to 'src/quick/handlers')
| -rw-r--r-- | src/quick/handlers/qquicktaphandler.cpp | 10 | ||||
| -rw-r--r-- | src/quick/handlers/qquicktaphandler_p.h | 1 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp index 5c1b59cf61..43c761f5fd 100644 --- a/src/quick/handlers/qquicktaphandler.cpp +++ b/src/quick/handlers/qquicktaphandler.cpp @@ -78,6 +78,8 @@ bool QQuickTapHandler::wantsEventPoint(const QPointerEvent *event, const QEventP bool ret = false; bool overThreshold = d_func()->dragOverThreshold(point); if (overThreshold && m_gesturePolicy != DragWithinBounds) { + if (m_longPressTimer.isActive()) + qCDebug(lcTapHandler) << objectName() << "drag threshold exceeded"; m_longPressTimer.stop(); m_holdTimer.invalidate(); } @@ -176,6 +178,7 @@ void QQuickTapHandler::timerEvent(QTimerEvent *event) if (event->timerId() == m_longPressTimer.timerId()) { m_longPressTimer.stop(); qCDebug(lcTapHandler) << objectName() << "longPressed"; + m_longPressed = true; emit longPressed(); } else if (event->timerId() == m_doubleTapTimer.timerId()) { m_doubleTapTimer.stop(); @@ -364,7 +367,9 @@ void QQuickTapHandler::setPressed(bool press, bool cancel, QPointerEvent *event, setExclusiveGrab(event, point, press); } if (!cancel && !press && parentContains(point)) { - if (point.timeHeld() < longPressThreshold()) { + if (m_longPressed) { + qCDebug(lcTapHandler) << objectName() << "long press threshold" << longPressThreshold() << "exceeded:" << point.timeHeld(); + } else { // Assuming here that pointerEvent()->timestamp() is in ms. const quint64 ts = event->timestamp(); const quint64 interval = ts - m_lastTapTimestamp; @@ -410,10 +415,9 @@ void QQuickTapHandler::setPressed(bool press, bool cancel, QPointerEvent *event, m_lastTapTimestamp = ts; m_lastTapPos = point.scenePosition(); - } else { - qCDebug(lcTapHandler) << objectName() << "tap threshold" << longPressThreshold() << "exceeded:" << point.timeHeld(); } } + m_longPressed = false; emit pressedChanged(); if (!press && m_gesturePolicy != DragThreshold) { // on release, ungrab after emitting changed signals diff --git a/src/quick/handlers/qquicktaphandler_p.h b/src/quick/handlers/qquicktaphandler_p.h index 8c6b6d162d..5e57e81a29 100644 --- a/src/quick/handlers/qquicktaphandler_p.h +++ b/src/quick/handlers/qquicktaphandler_p.h @@ -109,6 +109,7 @@ private: GesturePolicy m_gesturePolicy = GesturePolicy::DragThreshold; ExclusiveSignals m_exclusiveSignals = NotExclusive; bool m_pressed = false; + bool m_longPressed = false; static quint64 m_multiTapInterval; static int m_mouseMultiClickDistanceSquared; |
