aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2023-05-26 13:24:23 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-06-17 06:05:55 +0000
commit185888c6a82d6e11cd9f6614ef7616a28a87efc0 (patch)
treec3e5a4496e71814daee583ade5c98879797666b7
parentec5fee55ef1596db95d6f0ebcdf256b1ffd5da02 (diff)
Remove DA::deliverMatchingPointsToItem's second sendFilteredPointerEvent
a2209698d3584a7c05d0c12aa61de050fe0e78fd added sendFilteredPointerEvent earlier in this function; it doesn't make sense to do it multiple times. Fixes: QTBUG-109995 Fixes: QTBUG-113653 Change-Id: I9a9cb36ba060ec924ec3467fff0d7b0e3d474da3 Reviewed-by: Doris Verria <doris.verria@qt.io> (cherry picked from commit 2cb75d3126f0514701475077c719b5ea5ad9864e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quick/util/qquickdeliveryagent.cpp5
-rw-r--r--tests/auto/quick/qquicklistview2/tst_qquicklistview2.cpp31
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp53
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp2
4 files changed, 41 insertions, 50 deletions
diff --git a/src/quick/util/qquickdeliveryagent.cpp b/src/quick/util/qquickdeliveryagent.cpp
index 759b09f6b0..8d88ee91ca 100644
--- a/src/quick/util/qquickdeliveryagent.cpp
+++ b/src/quick/util/qquickdeliveryagent.cpp
@@ -2170,11 +2170,6 @@ void QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem(QQuickItem *item, b
if (item->acceptTouchEvents()) {
qCDebug(lcTouch) << "considering delivering" << &touchEvent << " to " << item;
- // If any parent filters the event, we're done.
- hasFiltered.clear();
- if (sendFilteredPointerEvent(&touchEvent, item))
- return;
-
// Deliver the touch event to the given item
qCDebug(lcTouch) << "actually delivering" << &touchEvent << " to " << item;
QCoreApplication::sendEvent(item, &touchEvent);
diff --git a/tests/auto/quick/qquicklistview2/tst_qquicklistview2.cpp b/tests/auto/quick/qquicklistview2/tst_qquicklistview2.cpp
index c83040fb11..22e26e7433 100644
--- a/tests/auto/quick/qquicklistview2/tst_qquicklistview2.cpp
+++ b/tests/auto/quick/qquicklistview2/tst_qquicklistview2.cpp
@@ -384,29 +384,31 @@ void tst_QQuickListView2::tapDelegateDuringFlicking_data()
{
QTest::addColumn<QByteArray>("qmlFile");
QTest::addColumn<QQuickFlickable::BoundsBehavior>("boundsBehavior");
+ QTest::addColumn<bool>("expectCanceled");
QTest::newRow("Button StopAtBounds") << QByteArray("buttonDelegate.qml")
- << QQuickFlickable::BoundsBehavior(QQuickFlickable::StopAtBounds);
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::StopAtBounds) << false;
QTest::newRow("MouseArea StopAtBounds") << QByteArray("mouseAreaDelegate.qml")
- << QQuickFlickable::BoundsBehavior(QQuickFlickable::StopAtBounds);
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::StopAtBounds) << true;
QTest::newRow("Button DragOverBounds") << QByteArray("buttonDelegate.qml")
- << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragOverBounds);
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragOverBounds) << false;
QTest::newRow("MouseArea DragOverBounds") << QByteArray("mouseAreaDelegate.qml")
- << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragOverBounds);
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragOverBounds) << true;
QTest::newRow("Button OvershootBounds") << QByteArray("buttonDelegate.qml")
- << QQuickFlickable::BoundsBehavior(QQuickFlickable::OvershootBounds);
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::OvershootBounds) << false;
QTest::newRow("MouseArea OvershootBounds") << QByteArray("mouseAreaDelegate.qml")
- << QQuickFlickable::BoundsBehavior(QQuickFlickable::OvershootBounds);
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::OvershootBounds) << true;
QTest::newRow("Button DragAndOvershootBounds") << QByteArray("buttonDelegate.qml")
- << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragAndOvershootBounds);
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragAndOvershootBounds) << false;
QTest::newRow("MouseArea DragAndOvershootBounds") << QByteArray("mouseAreaDelegate.qml")
- << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragAndOvershootBounds);
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragAndOvershootBounds) << true;
}
void tst_QQuickListView2::tapDelegateDuringFlicking() // QTBUG-103832
{
QFETCH(QByteArray, qmlFile);
QFETCH(QQuickFlickable::BoundsBehavior, boundsBehavior);
+ QFETCH(bool, expectCanceled);
QQuickView window;
QVERIFY(QQuickTest::showView(window, testFileUrl(qmlFile.constData())));
@@ -419,7 +421,16 @@ void tst_QQuickListView2::tapDelegateDuringFlicking() // QTBUG-103832
QVERIFY(listView->isFlicking()); // we want to test the case when it's still moving while we tap
// @y = 400 we pressed the 4th delegate; started flicking, and the press was canceled
QCOMPARE(listView->property("pressedDelegates").toList().first(), 4);
- QCOMPARE(listView->property("canceledDelegates").toList().first(), 4);
+ // At first glance one would expect MouseArea and Button would be consistent about this;
+ // but in fact, before ListView takes over the grab via filtering,
+ // Button.pressed transitions to false because QQuickAbstractButtonPrivate::handleMove
+ // sees that the touchpoint has strayed outside its bounds, but it does NOT emit the canceled signal
+ if (expectCanceled) {
+ const QVariantList canceledDelegates = listView->property("canceledDelegates").toList();
+ QCOMPARE(canceledDelegates.size(), 1);
+ QCOMPARE(canceledDelegates.first(), 4);
+ }
+ QCOMPARE(listView->property("releasedDelegates").toList().size(), 0);
// press a delegate during flicking (at y > 501 + 100, so likely delegate 6)
QTest::touchEvent(&window, touchDevice.data()).press(0, {100, 100});
@@ -442,7 +453,7 @@ void tst_QQuickListView2::tapDelegateDuringFlicking() // QTBUG-103832
QVERIFY(lastPressed > 5);
QCOMPARE(releasedDelegates.last(), lastPressed);
QCOMPARE(tappedDelegates.last(), lastPressed);
- QCOMPARE(canceledDelegates.size(), 1); // only the first press was canceled, not the second
+ QCOMPARE(canceledDelegates.size(), expectCanceled ? 1 : 0); // only the first press was canceled, not the second
}
void tst_QQuickListView2::flickDuringFlicking_data()
diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
index b0ba96bf43..81e57bfd12 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
+++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
@@ -723,12 +723,16 @@ void tst_QQuickMultiPointTouchArea::inFlickable()
// test that dragging out of a Flickable containing a MPTA doesn't harm Flickable's state.
void tst_QQuickMultiPointTouchArea::inFlickable2()
{
+ const int dragThreshold = QGuiApplication::styleHints()->startDragDistance();
QScopedPointer<QQuickView> window(createAndShowView("inFlickable2.qml"));
QVERIFY(window->rootObject() != nullptr);
QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable");
QVERIFY(flickable != nullptr);
+ QQuickMultiPointTouchArea *mpta = window->rootObject()->findChild<QQuickMultiPointTouchArea*>();
+ QVERIFY(mpta);
+
QQuickTouchPoint *point11 = window->rootObject()->findChild<QQuickTouchPoint*>("point1");
QVERIFY(point11);
@@ -741,25 +745,12 @@ void tst_QQuickMultiPointTouchArea::inFlickable2()
QQuickTouchUtils::flush(window.data());
QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, p1);
- p1 += QPoint(15,0);
- QTest::touchEvent(window.data(), device).move(0, p1);
- QQuickTouchUtils::flush(window.data());
- QTest::mouseMove(window.data(), p1);
-
- p1 += QPoint(15,0);
- QTest::touchEvent(window.data(), device).move(0, p1);
- QQuickTouchUtils::flush(window.data());
- QTest::mouseMove(window.data(), p1);
-
- p1 += QPoint(15,0);
- QTest::touchEvent(window.data(), device).move(0, p1);
- QQuickTouchUtils::flush(window.data());
- QTest::mouseMove(window.data(), p1);
-
- p1 += QPoint(15,0);
- QTest::touchEvent(window.data(), device).move(0, p1);
- QQuickTouchUtils::flush(window.data());
- QTest::mouseMove(window.data(), p1);
+ for (int i = 0; i < 4; ++i) {
+ p1 += QPoint(dragThreshold, 0);
+ QTest::touchEvent(window.data(), device).move(0, p1);
+ QQuickTouchUtils::flush(window.data());
+ QTest::mouseMove(window.data(), p1);
+ }
QVERIFY(!flickable->isMoving());
QVERIFY(point11->pressed());
@@ -772,27 +763,21 @@ void tst_QQuickMultiPointTouchArea::inFlickable2()
QTRY_VERIFY(!flickable->isMoving());
// Check that we can still move the Flickable
+ QSignalSpy gestureStartedSpy(mpta, &QQuickMultiPointTouchArea::gestureStarted);
p1 = QPoint(50,100);
QTest::touchEvent(window.data(), device).press(0, p1);
QQuickTouchUtils::flush(window.data());
QCOMPARE(point11->pressed(), true);
- p1 += QPoint(0,15);
- QTest::touchEvent(window.data(), device).move(0, p1);
- QQuickTouchUtils::flush(window.data());
-
- p1 += QPoint(0,15);
- QTest::touchEvent(window.data(), device).move(0, p1);
- QQuickTouchUtils::flush(window.data());
-
- p1 += QPoint(0,15);
- QTest::touchEvent(window.data(), device).move(0, p1);
- QQuickTouchUtils::flush(window.data());
-
- p1 += QPoint(0,15);
- QTest::touchEvent(window.data(), device).move(0, p1);
- QQuickTouchUtils::flush(window.data());
+ for (int i = 0; i < 4; ++i) {
+ p1 += QPoint(0, dragThreshold);
+ QTest::touchEvent(window.data(), device).move(0, p1);
+ QQuickTouchUtils::flush(window.data());
+ // QTBUG-113653: gestureStarted is emitted when touch delta exceeds drag threshold,
+ // regardless of the filtering Flickable parent
+ QCOMPARE(gestureStartedSpy.size(), i > 0 ? 1 : 0);
+ }
QVERIFY(flickable->contentY() < 0);
QVERIFY(flickable->isMoving());
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index ec98013c8b..4492d35680 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -713,7 +713,7 @@ void tst_TouchMouse::touchButtonOnFlickable()
QTRY_COMPARE(eventItem2->touchUngrabCount, 1);
qCDebug(lcTests) << "expected delivered events: press(touch) move(touch)" << eventItem2->eventList;
- QCOMPARE(eventItem2->eventList.size(), 2);
+ QCOMPARE(eventItem2->eventList.size(), 3);
QCOMPARE(eventItem2->eventList.at(1).type, QEvent::TouchUpdate);
QCOMPARE(grabMonitor.exclusiveGrabber, flickable);
// both EventItem and Flickable handled the actual touch, so synth-mouse doesn't happen