diff options
-rw-r--r-- | src/quicktemplates2/qquickstackview.cpp | 2 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_stackview.qml | 20 |
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) |