diff options
author | Jan Arve Saether <jan-arve.saether@qt.io> | 2017-05-22 15:34:18 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-05-26 10:59:37 +0000 |
commit | 0e3adb65b0e9c44fa6e202630ff57c907ecf0820 (patch) | |
tree | 1169b78f859b7702b246d4c08f30c935dbeb9550 /src/quick/items/qquickwindow.cpp | |
parent | b10e30705400a7967fd8c4215f201ce9586d9ecc (diff) |
Fix some problems with MouseDblClick handling
The sequence of events delivered from a double click is:
[Press,Release,Press,DblClick,Release]
The problem was that a DblClick was delivered just like a press event, so
it would clear the passive grabber that was established because of the
former Press event.
When the Release event then got processed, there was therefore a risk that
the Release event was not delivered to the passive grabber.
The fix is to not deliver DblClick events at all to handlers, and to not
deliver DblClick to items if the former Press event was accepted by a
handler.
Change-Id: I49c0e32ef4e33f7b6014d35dc065da2527b94779
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index e4eed8454c..713df4c500 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -503,6 +503,7 @@ QQuickWindowPrivate::QQuickWindowPrivate() , lastWheelEventAccepted(false) , componentCompleted(true) , allowChildEventFiltering(true) + , allowDoubleClick(true) , lastFocusReason(Qt::OtherFocusReason) , renderTarget(0) , renderTargetId(0) @@ -2092,7 +2093,8 @@ void QQuickWindowPrivate::handleMouseEvent(QMouseEvent *event) case QEvent::MouseButtonDblClick: Q_QUICK_INPUT_PROFILE(QQuickProfiler::Mouse, QQuickProfiler::InputMouseDoubleClick, event->button(), event->buttons()); - deliverPointerEvent(pointerEventInstance(event)); + if (allowDoubleClick) + deliverPointerEvent(pointerEventInstance(event)); break; case QEvent::MouseMove: Q_QUICK_INPUT_PROFILE(QQuickProfiler::Mouse, QQuickProfiler::InputMouseMove, @@ -2404,7 +2406,11 @@ void QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QQuickPo pointerEvent->localize(item); // Let the Item's handlers (if any) have the event first. - itemPrivate->handlePointerEvent(pointerEvent); + // However, double click should never be delivered to handlers. + if (!pointerEvent->isDoubleClickEvent()) { + itemPrivate->handlePointerEvent(pointerEvent); + allowDoubleClick = !(pointerEvent->asPointerMouseEvent() && pointerEvent->isPressEvent() && pointerEvent->allPointsAccepted()); + } if (handlersOnly) return; if (pointerEvent->allPointsAccepted() && !pointerEvent->isReleaseEvent()) |