Priority: P1: Critical
Affects Version/s: 6.0, 6.3.0 Beta2
Fix Version/s: None
Component/s: Quick: Mouse Touch and Tablet input
In Qt 5 we had this code:
In Qt 6, we have QPointerEvent::setExclusiveGrabber() and we're using it directly. It's in QtGui, and knows nothing about how to get approval for a grab transition. So it seems we will need to write a wrapper function in Qt Quick to restore this feature, or else come up with some sort of callback mechanism so that Qt Quick can provide an approver function that QtGui can call. And the nice thing about an approver function would be that even if e.g. a QWidget or something in Qt Quick 3D tries to take the grab from a handler, it would have a chance to say no (in case of hybrid applications); whereas with a wrapper function just for Qt Quick, we'd have to remember to use it everywhere (add a note to QPointerEvent::setExclusiveGrabber() that it should never be called directly from Qt Quick).
It comes up when trying to use a TapHandler to open a context menu on a TextArea, for example:
When pressing the right mouse button, TapHandler gets a grab first (gesturePolicy makes it an exclusive grab), and TextArea gets to take over the grab without even asking, merely by accepting the event. That is because QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem() calls pointerEvent->setExclusiveGrabber() directly. But we have many such places in Qt Quick.
|For Gerrit Dashboard: QTBUG-101398|
|398772,5||Add QPtDevPriv::setGrabTransitionApprover; setExclGrabber: return bool||dev||qt/qtbase||Status: NEW||-1||0|
|398773,3||setGrabTransitionApprover when handling each "begin" event||dev||qt/qtdeclarative||Status: NEW||0||0|