aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Dippold <michael.dippold@us.thalesgroup.com>2017-02-22 20:40:47 -0800
committerMichael Dippold <michael.dippold@us.thalesgroup.com>2017-02-23 21:29:39 +0000
commitec1f70c4c58b923ff50eb4adc36c88e5a6611281 (patch)
treea022e77a57f5cdefa871dec2f89ff5732cc9112a
parentbb927cb602bcd7e6ae1e67080d11aa93daeca200 (diff)
Prevent StackView filtering of UngrabMouse event
Currently the StackView is filtering the UngrabMouse event during transitions. If a MouseArea is still in the pressed state during this time it will forever be in the pressed state as the ungrab event is filtered. Task-number: QTBUG-59098 Change-Id: I7effdad6a36b64336b4770a1dca61ba47998b787 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
-rw-r--r--src/quicktemplates2/qquickstackview.cpp2
-rw-r--r--tests/auto/controls/data/tst_stackview.qml20
2 files changed, 22 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickstackview.cpp b/src/quicktemplates2/qquickstackview.cpp
index 2e4d2528..cf2b5a66 100644
--- a/src/quicktemplates2/qquickstackview.cpp
+++ b/src/quicktemplates2/qquickstackview.cpp
@@ -1001,6 +1001,8 @@ bool QQuickStackView::childMouseEventFilter(QQuickItem *item, QEvent *event)
// breaking its state (QTBUG-50305).
if (event->type() == QEvent::MouseButtonPress)
return true;
+ if (event->type() == QEvent::UngrabMouse)
+ return false;
QQuickWindow *window = item->window();
return window && !window->mouseGrabberItem();
}
diff --git a/tests/auto/controls/data/tst_stackview.qml b/tests/auto/controls/data/tst_stackview.qml
index ae1c7d36..5c0d20d1 100644
--- a/tests/auto/controls/data/tst_stackview.qml
+++ b/tests/auto/controls/data/tst_stackview.qml
@@ -875,6 +875,26 @@ TestCase {
compare(testItem.cancels, 0)
}
+ function test_ungrab() {
+ var control = createTemporaryObject(stackView, testCase, {initialItem: mouseArea, width: testCase.width, height: testCase.height})
+ verify(control)
+
+ var testItem = control.currentItem
+ verify(testItem)
+
+ mousePress(testItem)
+ control.push(mouseArea)
+ tryCompare(control, "busy", false)
+ mouseRelease(testItem)
+
+ compare(testItem.presses, 1)
+ compare(testItem.releases, 0)
+ compare(testItem.clicks, 0)
+ compare(testItem.doubleClicks, 0)
+ compare(testItem.pressed, false)
+ compare(testItem.cancels, 1)
+ }
+
function test_failures() {
var control = createTemporaryObject(stackView, testCase, {initialItem: component})
verify(control)