aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2021-03-25 22:48:20 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2021-05-05 15:37:32 +0000
commitbae1598c2a0db724626c5a8e37a5874f2a46354a (patch)
treeb7dce281d87430b93b21860b2b800fae69048062 /src
parent8e400a48285e58c938fe24367251cc04c1d00985 (diff)
DragHandler: don't try to handle native gesture events
No gesture handling has been implemented in DragHandler (although we could). It just made the target item jump unintentionally. QQuickMultiPointHandler::wantsPointerEvent() returns true for gestures, because PinchHandler handles them, and the pattern is that base classes only rule out some kinds of events but leave the final decision up to the leaf class. The autotest has to use a touchpad now, not the primary pointing device, because QQuickPointerDeviceHandler::wantsPointerEvent() returns false if pointerType != Finger and acceptedButtons() is not satisfied. Fixes: QTBUG-92165 Change-Id: I984de750c9ae892f3ee61c7ed5b3ac4a7d187024 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 73051631545dc59d4419a5ef2202355349aab480) Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quick/handlers/qquickdraghandler.cpp13
-rw-r--r--src/quick/handlers/qquickdraghandler_p.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/quick/handlers/qquickdraghandler.cpp b/src/quick/handlers/qquickdraghandler.cpp
index e5e9b03f32..980481303f 100644
--- a/src/quick/handlers/qquickdraghandler.cpp
+++ b/src/quick/handlers/qquickdraghandler.cpp
@@ -179,6 +179,19 @@ void QQuickDragHandler::onActiveChanged()
}
}
+bool QQuickDragHandler::wantsPointerEvent(QPointerEvent *event)
+{
+ if (!QQuickMultiPointHandler::wantsPointerEvent(event))
+ return false;
+
+#if QT_CONFIG(gestures)
+ if (event->type() == QEvent::NativeGesture)
+ return false;
+#endif
+
+ return true;
+}
+
void QQuickDragHandler::handlePointerEventImpl(QPointerEvent *event)
{
QQuickMultiPointHandler::handlePointerEventImpl(event);
diff --git a/src/quick/handlers/qquickdraghandler_p.h b/src/quick/handlers/qquickdraghandler_p.h
index c1ff108e13..dfd0961b49 100644
--- a/src/quick/handlers/qquickdraghandler_p.h
+++ b/src/quick/handlers/qquickdraghandler_p.h
@@ -94,6 +94,7 @@ Q_SIGNALS:
Q_REVISION(2, 14) void snapModeChanged();
protected:
+ bool wantsPointerEvent(QPointerEvent *event) override;
void onActiveChanged() override;
void onGrabChanged(QQuickPointerHandler *grabber, QPointingDevice::GrabTransition transition, QPointerEvent *event, QEventPoint &point) override;