diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-05-10 22:06:33 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-05-15 17:21:33 +0000 |
commit | 92269400ed1876b0ea1e87571cfa6281edcad7d3 (patch) | |
tree | c9b544e0a5a7d8c73d8ada2f510ea413e020411c | |
parent | c673220a3cdb03ba0aa2c0d09e14af9a2112f4a8 (diff) |
Don't allow one handler to cancel another's grab, unless it is stealing
This is required to keep the tst_flickableinterop touchDragSlider test
passing after the change to TapHandler to never give up passive grab.
And QQuickEventPoint::setGrabberPointerHandler(nullptr, true)
will just go ahead and allow TapHandler to cancel the grab which
the DragHandler currently has at that time, when you have pressed
the TapHandler but started dragging so that the drag threshold is
exceeded. (Perhaps this points to an API problem.) For now, we at
least can enforce the rule in QQuickPointerHandler::setExclusiveGrab
that if grab is false, it won't nullify the grab of a different handler.
Change-Id: I7c93188cfdce51b3b5a17c13e5efc7fcbd123d4b
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
-rw-r--r-- | src/quick/handlers/qquickpointerhandler.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/quick/handlers/qquickpointerhandler.cpp b/src/quick/handlers/qquickpointerhandler.cpp index 8f539d4678..3774c2d24c 100644 --- a/src/quick/handlers/qquickpointerhandler.cpp +++ b/src/quick/handlers/qquickpointerhandler.cpp @@ -138,6 +138,9 @@ void QQuickPointerHandler::setExclusiveGrab(QQuickEventPoint *point, bool grab) { // TODO m_hadKeepMouseGrab m_hadKeepTouchGrab qCDebug(lcPointerHandlerDispatch) << point << grab; + // Don't allow one handler to cancel another's grab, unless it is stealing it for itself + if (!grab && point->grabberPointerHandler() != this) + return; point->setGrabberPointerHandler(grab ? this : nullptr, true); } |