From e9a2155cfd76666043dee8c034708a0149f3e2e6 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 10 Feb 2017 10:01:39 +0100 Subject: DragHandler: keep the grab (prevent stealing) when dragging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Whenever the DragHandler gets an exclusive grab, it needs to prevent a parent Flickable (for example) from taking over that grab. Since it waits until the drag threshold is exceeded in an allowed dragging direction, this does not prevent the Flickable from being draggable in the other direction. We restore the state of keepTouchGrab and keepMouseGrab when ungrabbing. Change-Id: Id9d456c99322e0cb6996d1f690b38fcd6becc6f9 Reviewed-by: Jan Arve Sæther --- src/quick/handlers/qquickdraghandler.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/quick/handlers/qquickdraghandler.cpp') diff --git a/src/quick/handlers/qquickdraghandler.cpp b/src/quick/handlers/qquickdraghandler.cpp index 9575f7ede9..db17df36ca 100644 --- a/src/quick/handlers/qquickdraghandler.cpp +++ b/src/quick/handlers/qquickdraghandler.cpp @@ -98,6 +98,14 @@ void QQuickDragHandler::handleEventPoint(QQuickEventPoint *point) } else if ((m_xAxis.enabled() && QQuickWindowPrivate::dragOverThreshold(delta.x(), Qt::XAxis, point)) || (m_yAxis.enabled() && QQuickWindowPrivate::dragOverThreshold(delta.y(), Qt::YAxis, point))) { setExclusiveGrab(point); + if (target()) { + if (point->pointerEvent()->asPointerTouchEvent()) + target()->setKeepTouchGrab(true); + // tablet and mouse are treated the same by Item's legacy event handling, and + // touch becomes synth-mouse for Flickable, so we need to prevent stealing + // mouse grab too, whenever dragging occurs in an enabled direction + target()->setKeepMouseGrab(true); + } } } break; default: -- cgit v1.2.3