aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/touchmouse
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-07-14 20:09:57 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2021-02-25 10:31:37 +0100
commitf35afe3eeaa460cb5e96171fb8a43fdf52c8761c (patch)
tree32b5c087a30a5dc455b8505415b0372c661f24cd /tests/auto/quick/touchmouse
parent4853b3a7d50c20ad00a2780b8d11a0f9c38462ae (diff)
Move event delivery from QQWindow to QQuickDeliveryAgent
QQuickWindow owns QQuickRootItem which owns QQuickDeliveryAgent, so for every window there's an object responsible for event delivery, while the window itself is mainly responsible for rendering (separation of concerns). However, QQuickRootItem and QQuickDeliveryAgent can now be used in cases where the scene doesn't directly belong to a window, such as when a Qt Quick sub-scene is mapped somewhere into a Qt Quick 3D scene. In that case, we must remember which delivery agent was in use at the time when a QEventPoint is grabbed and deliver subsequent updates via the same DA. There's also a QQuickDeliveryAgent::Transform abstraction which subscene-management code (such as QQuick3DViewport) can implement, to provide a formula to map the window's scene coordinates to subscene coordinates; if defined, it will be used during delivery of subsequent updates to existing grabbers. Task-number: QTBUG-84870 Change-Id: I70b433f7ebb05d2e60214ff3192e05da0aa84a42 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 68c103225f4e8bd6c1b18ef547108fd60f398c0f) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/quick/touchmouse')
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index 33698b4141..ef0df0cddb 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -194,7 +194,7 @@ public:
switch (transition) {
case QPointingDevice::GrabTransition::GrabExclusive:
exclusiveGrabber = grabber;
- fromMouseEvent = event && QQuickWindowPrivate::isMouseEvent(event);
+ fromMouseEvent = event && QQuickDeliveryAgentPrivate::isMouseEvent(event);
canceled = false;
break;
case QPointingDevice::GrabTransition::UngrabExclusive:
@@ -641,7 +641,7 @@ void tst_TouchMouse::buttonOnFlickable()
QCOMPARE(eventItem1->eventList.at(0).type, QEvent::MouseButtonPress);
QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(&window);
- QVERIFY(windowPriv->touchMouseId != -1);
+ QVERIFY(windowPriv->deliveryAgentPrivate()->touchMouseId != -1);
auto devPriv = QPointingDevicePrivate::get(device);
QCOMPARE(devPriv->pointById(0)->exclusiveGrabber, eventItem1);
QCOMPARE(grabMonitor.exclusiveGrabber, eventItem1);
@@ -662,7 +662,7 @@ void tst_TouchMouse::buttonOnFlickable()
QCOMPARE(eventItem1->eventList.at(3).type, QEvent::UngrabMouse);
QCOMPARE(grabMonitor.exclusiveGrabber, flickable);
- QVERIFY(windowPriv->touchMouseId != -1);
+ QVERIFY(windowPriv->deliveryAgentPrivate()->touchMouseId != -1);
QCOMPARE(devPriv->pointById(0)->exclusiveGrabber, flickable);
QTest::touchEvent(&window, device).release(0, p1, &window);
@@ -696,7 +696,7 @@ void tst_TouchMouse::touchButtonOnFlickable()
QCOMPARE(eventItem2->eventList.at(0).type, QEvent::TouchBegin);
QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(&window);
- QVERIFY(windowPriv->touchMouseId == -1);
+ QVERIFY(windowPriv->deliveryAgentPrivate()->touchMouseId == -1);
auto devPriv = QPointingDevicePrivate::get(device);
QCOMPARE(devPriv->pointById(0)->exclusiveGrabber, eventItem2);
QCOMPARE(grabMonitor.exclusiveGrabber, eventItem2);
@@ -720,7 +720,7 @@ void tst_TouchMouse::touchButtonOnFlickable()
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
- QCOMPARE(windowPriv->touchMouseId, -1);
+ QCOMPARE(windowPriv->deliveryAgentPrivate()->touchMouseId, -1);
QCOMPARE(devPriv->pointById(0)->exclusiveGrabber, flickable);
QVERIFY(flickable->isMovingVertically());
@@ -783,7 +783,7 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable()
// wait to avoid getting a double click event
QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10);
QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(&window);
- QCOMPARE(windowPriv->touchMouseId, -1); // no grabber
+ QCOMPARE(windowPriv->deliveryAgentPrivate()->touchMouseId, -1); // no grabber
// touch press
QPoint p1 = QPoint(10, 110);
@@ -1535,7 +1535,7 @@ void tst_TouchMouse::implicitUngrab()
QVERIFY(!eventItem->eventList.isEmpty());
QCOMPARE(eventItem->eventList.at(0).type, QEvent::UngrabMouse);
QTest::touchEvent(&window, device).release(0, p1); // clean up potential state
- QCOMPARE(windowPriv->touchMouseId, -1);
+ QCOMPARE(windowPriv->deliveryAgentPrivate()->touchMouseId, -1);
eventItem->setEnabled(true);
QTest::touchEvent(&window, device).press(0, p1);