aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2019-12-05 12:46:25 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2019-12-09 17:37:35 +0000
commit6dff64714e3683c1af6164f99ffe23b3a0001be1 (patch)
tree3c33a5c8c255ec790ea07592162e1d1bb2be55b2 /src
parente93a471dfde3c3b08d41eac53e595129ca520c68 (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> (cherry picked from commit 7cdc3727a2b01c59d0a9e19a3cfc4e226ac1ab77)
Diffstat (limited to 'src')
-rw-r--r--src/quick/handlers/qquicktaphandler.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp
index 61f97868e8..276b80abaa 100644
--- a/src/quick/handlers/qquicktaphandler.cpp
+++ b/src/quick/handlers/qquicktaphandler.cpp
@@ -140,17 +140,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;
}