diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-12-05 12:46:25 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-12-06 13:46:10 +0100 |
commit | 7cdc3727a2b01c59d0a9e19a3cfc4e226ac1ab77 (patch) | |
tree | 3527849e4bbe1e22dbd2b492441970f350ea6be8 /src | |
parent | f8df9dc8b45cd9e386b66255183c58f3dfcc41a9 (diff) |
TapHandler: don't reject stationary touchpoints
Multiple TapHandlers must be able to react to multiple touchpoints.
Often when multiple touchpoints are in contact, some of them will be
stationary. In that case TapHandler should not give up its active
state, which is the result of returning false from wantsEventPoint().
This partially reverts commit dcc7367997e7241918cdf0c702c7bb8325eb1ad4.
Fixes: QTBUG-76954
Change-Id: I836baf771f09d48be8d032472b0c3143e8f7f723
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/handlers/qquicktaphandler.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp index 7b26adbe6f..bfb3df7c6c 100644 --- a/src/quick/handlers/qquicktaphandler.cpp +++ b/src/quick/handlers/qquicktaphandler.cpp @@ -139,17 +139,16 @@ bool QQuickTapHandler::wantsEventPoint(QQuickEventPoint *point) } break; case QQuickEventPoint::Stationary: - // Never react in any way when the point hasn't moved. - // In autotests, the point's position may not even be correct, because - // QTest::touchEvent(window, touchDevice).stationary(1) - // provides no opportunity to give a position, so it ends up being random. + // If the point hasn't moved since last time, the return value should be the same as last time. + // If we return false here, QQuickPointerHandler::handlePointerEvent() will call setActive(false). + ret = point->pointId() == this->point().id(); break; } // If this is the grabber, returning false from this function will cancel the grab, // so onGrabChanged(this, CancelGrabExclusive, point) and setPressed(false) will be called. // But when m_gesturePolicy is DragThreshold, we don't get an exclusive grab, but // we still don't want to be pressed anymore. - if (!ret && point->pointId() == this->point().id() && point->state() != QQuickEventPoint::Stationary) + if (!ret && point->pointId() == this->point().id()) setPressed(false, true, point); return ret; } |