aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickwindow.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-12-04 12:27:23 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-12-10 10:06:53 +0000
commitf8f0f0835a971a658f4ee2ae386e448338b1a7d7 (patch)
treee3c84916a2b5e8f5e1f19c8dd5034e5487dd9b7a /src/quick/items/qquickwindow.cpp
parentecec3d45ece7f0754f2bdede3aaadb13ab71e3c4 (diff)
TapHandler: ignore scroll events and native gestures
During a 2-finger press (to emulate right click on a trackpad), the OS may also generate a QWheelEvent with ScrollBegin phase just in case scrolling starts. This must not prematurely deactivate the TapHandler. Also if a gesture or wheel event begins as the very first event after an application starts, ensure that subsequent mouse events are not mis-delivered as wheel or gesture events. Fixes: QTBUG-71955 Change-Id: Ic12e116483ab9ad37c4ac3b1d10ccb62e1349e0a Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r--src/quick/items/qquickwindow.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 83a1268d1d..dd5960e925 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -2246,13 +2246,14 @@ QQuickPointerEvent *QQuickWindowPrivate::queryPointerEventInstance(QQuickPointer
{
// Search for a matching reusable event object.
for (QQuickPointerEvent *e : pointerEventInstances) {
- // If device can generate native gestures (e.g. a trackpad), there might be two QQuickPointerEvents:
- // QQuickPointerNativeGestureEvent and QQuickPointerTouchEvent. Use eventType to disambiguate.
+ // If device can generate native gestures (e.g. a trackpad), there might be multiple QQuickPointerEvents:
+ // QQuickPointerNativeGestureEvent, QQuickPointerScrollEvent, and QQuickPointerTouchEvent.
+ // Use eventType to disambiguate.
#if QT_CONFIG(gestures)
- if (eventType == QEvent::NativeGesture && !qobject_cast<QQuickPointerNativeGestureEvent*>(e))
+ if ((eventType == QEvent::NativeGesture) != bool(e->asPointerNativeGestureEvent()))
continue;
#endif
- if (eventType == QEvent::Wheel && !qobject_cast<QQuickPointerScrollEvent*>(e))
+ if ((eventType == QEvent::Wheel) != bool(e->asPointerScrollEvent()))
continue;
// Otherwise we assume there's only one event type per device.
// More disambiguation tests might need to be added above if that changes later.