diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-05-14 09:04:42 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-05-14 09:09:09 (GMT) |
commit | 5db3e40ca796f29cbd7bfc5f7f88823f6e27c16f (patch) | |
tree | 2fdaa59ec88c57a0ad2b440828b8189cde16c7f0 /src/gui | |
parent | cf9277b5e9e20d47681ab084e4410c3566425c3c (diff) | |
download | Qt-5db3e40ca796f29cbd7bfc5f7f88823f6e27c16f.zip Qt-5db3e40ca796f29cbd7bfc5f7f88823f6e27c16f.tar.gz Qt-5db3e40ca796f29cbd7bfc5f7f88823f6e27c16f.tar.bz2 |
Fix sending of double-click events after explicit grab-ungrab.
The bug report came from the Declarative UI project as part of Kinetic.
In FxFlickable the mouse is explicitly grabbed inside the mouse press
event handler, and it's (explicitly) released in the release handler.
When doing this, lastMouseGrabber is 0, and the double-click is delivered
as a press. The fix is to not convert the double-click to a press if the
receiver is the first and only mouse grabber (i.e., lastMouseGrabber is
0).
The fix isn't entirely correct, as it can in theory allow an item to
receive a double-click event as the first received event. This seems
to only be possible in the case of using explicit mouse grabbing in
combinations with the press and release event handlers so it's quite
a corner case.
Reviewed-by: Alexis
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 69e08d1..9892d36 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1329,7 +1329,8 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou // check if the item we are sending to are disabled (before we send the event) bool disabled = !item->isEnabled(); bool isWindow = item->isWindow(); - if (mouseEvent->type() == QEvent::GraphicsSceneMouseDoubleClick && item != lastMouseGrabberItem) { + if (mouseEvent->type() == QEvent::GraphicsSceneMouseDoubleClick + && item != lastMouseGrabberItem && lastMouseGrabberItem) { // If this item is different from the item that received the last // mouse event, and mouseEvent is a doubleclick event, then the // event is converted to a press. Known limitation: |