From 38a85ab980b7cd98e0df42115c4e26d7e9d73b2e Mon Sep 17 00:00:00 2001 From: Alex Sedighi Date: Mon, 5 Dec 2016 14:15:20 +1300 Subject: [PATCH] NSW-34742 To reset a global variable properly which controls where a new MousePressButton event would be synthesized from a TouchBegin --- qtbase/src/gui/kernel/qguiapplication.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/qtbase/src/gui/kernel/qguiapplication.cpp b/qtbase/src/gui/kernel/qguiapplication.cpp index 95e47e1..668eb2c 100644 --- a/qtbase/src/gui/kernel/qguiapplication.cpp +++ b/qtbase/src/gui/kernel/qguiapplication.cpp @@ -2508,6 +2508,23 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To // QTBUG-37371 temporary fix; TODO: revisit in 5.4 when we have a forwarding solution if (eventType == QEvent::TouchEnd) { + + // QTBUG-57465 If a modal dialog gets open while the user has not yet + // released their touch, then the first TouchBegin on the dialog + // would not be translated to a mousePressButton. + // It's because normally there should be a TouchBegin before this + // TouchEnd for which "buttons" would show "a button is pressed". + // As we are not going to create a fake mouse event for the + // TouchEnd here, "buttons" won't get reset properly. This + // prevents the next TouchBegin from being translated to a + // synthesized mouse event in function processMouseEvent as there + // the mouse state (stateChange) would not show any changes then. + // The following line is a way of fixing this problem. Another + // approach would be by letting this TouchEnd pass through here and be + // translated to a MouseReleaseButton in addition to the + // TouchCancel that we are going to generate. + buttons &= ~Qt::LeftButton; + // but don't leave dangling state: e.g. // QQuickWindowPrivate::itemForTouchPointId needs to be cleared. QTouchEvent touchEvent(QEvent::TouchCancel, -- 2.8.1.windows.1