diff options
author | Antti Määttä <antti.maatta@qt.io> | 2022-06-15 10:52:20 +0300 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-06-23 05:20:57 +0000 |
commit | c3aaa51a36063d4804ce0e9ca1d9bf4a358a4568 (patch) | |
tree | e7b48394a7636e57b3048bdded9520122a315e4a /tests/auto/quick/qquickflickable/tst_qquickflickable.cpp | |
parent | 17b903ce6f0c01f9b46985394000cf4eaa06435d (diff) |
Handle unprocessed pressed case in Flickable
Handle case where Flickable filters a pressed event before the receiver
has decided whether it wants to keep the grab. That causes the Flickable
to not process the press event, but still processes all the later
events.
This happens when the receiver is MouseArea so add special case
for it in Flickable, where we start the drag if all conditions are met.
Fixes: QTBUG-38765
Fixes: QTBUG-74842
Change-Id: I2e02042cb496e9eb3b7b5da824e56f76ee76ccbb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit d7b5a485583004ad6a1374a50b7c3f6cab00aca3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/quick/qquickflickable/tst_qquickflickable.cpp')
-rw-r--r-- | tests/auto/quick/qquickflickable/tst_qquickflickable.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index 1035aeeb38..8180d69602 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -217,6 +217,7 @@ private slots: void stopAtBounds(); void stopAtBounds_data(); void nestedMouseAreaUsingTouch(); + void nestedMouseAreaPropagateComposedEvents(); void nestedSliderUsingTouch(); void nestedSliderUsingTouch_data(); void pressDelayWithLoader(); @@ -2123,6 +2124,27 @@ void tst_qquickflickable::nestedMouseAreaUsingTouch() QVERIFY(nested->y() < 100.0); } +void tst_qquickflickable::nestedMouseAreaPropagateComposedEvents() +{ + QScopedPointer<QQuickView> window(new QQuickView); + window->setSource(testFileUrl("nestedmouseareapce.qml")); + QTRY_COMPARE(window->status(), QQuickView::Ready); + QQuickViewTestUtils::centerOnScreen(window.data()); + QQuickViewTestUtils::moveMouseAway(window.data()); + window->show(); + QVERIFY(window->rootObject() != nullptr); + QVERIFY(QTest::qWaitForWindowActive(window.data())); + + QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); + QVERIFY(flickable != nullptr); + + QCOMPARE(flickable->contentY(), 50.0f); + flickWithTouch(window.data(), QPoint(100, 300), QPoint(100, 200)); + + // flickable should have moved + QVERIFY(!qFuzzyCompare(flickable->contentY(), 50.0)); +} + void tst_qquickflickable::nestedSliderUsingTouch_data() { QTest::addColumn<bool>("keepMouseGrab"); |