diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2016-08-24 12:40:23 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2016-08-24 13:52:08 +0000 |
commit | 651ecf9ae413478af622761e89347bb4e6243e0c (patch) | |
tree | 931200743f2f60619d10fe11b4ed34ba84a69396 /src/quick/items/qquickwindow.cpp | |
parent | 4e9fc0129d6b4326c2159e4fafa42a3df9d35e0a (diff) |
Fix mouse area pressed after removal of pre-grab
Qt Quick used to actively "grab" the mouse before delivering events,
making the code more complex than necessary. Some items came to rely on
the behavior and now lack the ungrab event. This is triggered when
inside the delivery of a mouse event, some other item grabs the mouse.
If the mouse grab changed to an item that was not the target of the
original delivery, the grab must have been stolen, so call
mouseUngrabEvent in this case.
Test case by J-P Nurmi.
Task-number: QTBUG-55325
Change-Id: I2f0ac9d8aed1415662196070fb763f2752004d22
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index a54d6daf9c..c72565b2f4 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -2247,8 +2247,12 @@ bool QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QQuickPo me->accept(); q->sendEvent(item, me); if (me->isAccepted()) { - if (!q->mouseGrabberItem()) + auto mouseGrabber = q->mouseGrabberItem(); + if (mouseGrabber && mouseGrabber != item) { + item->mouseUngrabEvent(); + } else { item->grabMouse(); + } point->setAccepted(true); } return me->isAccepted(); |