diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-07-13 13:40:04 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-07-15 20:52:59 +0200 |
commit | c0e72e34863a5628c51e5c3bb42bcc455c310340 (patch) | |
tree | 71e661d2c54258a756087627227f4feb39521bae /tests | |
parent | 151f58dc29f4b53fb46a96d773aee8641593e5c7 (diff) |
Replace QTouchEvent::TouchPoint with QEventPoint
It's a cosmetic change at this time, because we have declared
using TouchPoint = QEventPoint;
Also replace Qt::TouchPointState enum with QEventPoint::State.
Task-number: QTBUG-72173
Change-Id: Ife017aa98801c28abc6cccd106f47a95421549de
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests')
8 files changed, 147 insertions, 147 deletions
diff --git a/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp index 0c300cfd4e..89e9fa3f23 100644 --- a/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp @@ -186,9 +186,9 @@ void tst_QQuickPinchHandler::pinchProperties() QCOMPARE(rotMaxSpy.count(),1); } -QTouchEvent::TouchPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickItem *i) +QEventPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickItem *i) { - QTouchEvent::TouchPoint touchPoint(id); + QEventPoint touchPoint(id); touchPoint.setPos(i->mapFromScene(p)); touchPoint.setScreenPos(v->mapToGlobal(p)); touchPoint.setScenePos(p); diff --git a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp index cb20168c1d..6f81e6b566 100644 --- a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp @@ -51,13 +51,13 @@ public: }; Q_ENUM(Destination) - Event(Destination d, QEvent::Type t, Qt::TouchPointState s, int grabTransition, QPointF item, QPointF scene) + Event(Destination d, QEvent::Type t, QEventPoint::State s, int grabTransition, QPointF item, QPointF scene) : destination(d), type(t), state(s), grabTransition(grabTransition), posWrtItem(item), posWrtScene(scene) {} Destination destination; QEvent::Type type; // if this represents a QEvent that was received - Qt::TouchPointState state; // if this represents an event (pointer, touch or mouse) + QEventPoint::State state; // if this represents an event (pointer, touch or mouse) int grabTransition; // if this represents an onGrabChanged() notification (QQuickEventPoint::GrabTransition) QPointF posWrtItem; QPointF posWrtScene; @@ -98,46 +98,46 @@ public: : QQuickItem(parent), acceptPointer(false), grabPointer(false), acceptMouse(false), acceptTouch(false), filterTouch(false) {} - inline int grabTransition(bool accept, Qt::TouchPointState state) { - return (accept && (state != Qt::TouchPointReleased)) ? (int)QQuickEventPoint::GrabExclusive : (int)NoGrab; + inline int grabTransition(bool accept, QEventPoint::State state) { + return (accept && (state != QEventPoint::State::Released)) ? (int)QQuickEventPoint::GrabExclusive : (int)NoGrab; } void touchEvent(QTouchEvent *event) { qCDebug(lcPointerTests) << event << "will accept?" << acceptTouch; - for (const QTouchEvent::TouchPoint &tp : event->touchPoints()) + for (const QEventPoint &tp : event->touchPoints()) eventList.append(Event(Event::TouchDestination, event->type(), tp.state(), grabTransition(acceptTouch, tp.state()), tp.position(), tp.scenePosition())); event->setAccepted(acceptTouch); } void mousePressEvent(QMouseEvent *event) { qCDebug(lcPointerTests) << event; - eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointPressed, grabTransition(acceptMouse, Qt::TouchPointPressed), event->position().toPoint(), event->scenePosition())); + eventList.append(Event(Event::MouseDestination, event->type(), QEventPoint::State::Pressed, grabTransition(acceptMouse, QEventPoint::State::Pressed), event->position().toPoint(), event->scenePosition())); event->setAccepted(acceptMouse); } void mouseMoveEvent(QMouseEvent *event) { qCDebug(lcPointerTests) << event; - eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointMoved, grabTransition(acceptMouse, Qt::TouchPointMoved), event->position().toPoint(), event->scenePosition())); + eventList.append(Event(Event::MouseDestination, event->type(), QEventPoint::State::Updated, grabTransition(acceptMouse, QEventPoint::State::Updated), event->position().toPoint(), event->scenePosition())); event->setAccepted(acceptMouse); } void mouseReleaseEvent(QMouseEvent *event) { qCDebug(lcPointerTests) << event; - eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointReleased, grabTransition(acceptMouse, Qt::TouchPointReleased), event->position().toPoint(), event->scenePosition())); + eventList.append(Event(Event::MouseDestination, event->type(), QEventPoint::State::Released, grabTransition(acceptMouse, QEventPoint::State::Released), event->position().toPoint(), event->scenePosition())); event->setAccepted(acceptMouse); } void mouseDoubleClickEvent(QMouseEvent *event) { qCDebug(lcPointerTests) << event; - eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointPressed, grabTransition(acceptMouse, Qt::TouchPointPressed), event->position().toPoint(), event->scenePosition())); + eventList.append(Event(Event::MouseDestination, event->type(), QEventPoint::State::Pressed, grabTransition(acceptMouse, QEventPoint::State::Pressed), event->position().toPoint(), event->scenePosition())); event->setAccepted(acceptMouse); } void mouseUngrabEvent() { qCDebug(lcPointerTests); - eventList.append(Event(Event::MouseDestination, QEvent::UngrabMouse, Qt::TouchPointReleased, QQuickEventPoint::UngrabExclusive, QPoint(0,0), QPoint(0,0))); + eventList.append(Event(Event::MouseDestination, QEvent::UngrabMouse, QEventPoint::State::Released, QQuickEventPoint::UngrabExclusive, QPoint(0,0), QPoint(0,0))); } bool event(QEvent *event) @@ -161,7 +161,7 @@ public: event->type() == QEvent::TouchCancel || event->type() == QEvent::TouchEnd) { QTouchEvent *touch = static_cast<QTouchEvent*>(event); - for (const QTouchEvent::TouchPoint &tp : touch->touchPoints()) + for (const QEventPoint &tp : touch->touchPoints()) eventList.append(Event(Event::FilterDestination, event->type(), tp.state(), QQuickEventPoint::GrabExclusive, tp.position(), tp.scenePosition())); if (filterTouch) event->accept(); @@ -207,7 +207,7 @@ public: setExclusiveGrab(point, true); qCDebug(lcPointerTests) << " " << i << ":" << point << "accepted?" << item->acceptPointer << "grabbed?" << (point->exclusiveGrabber() == this); item->eventList.append(Event(Event::HandlerDestination, QEvent::Pointer, - static_cast<Qt::TouchPointState>(point->state()), + static_cast<QEventPoint::State>(point->state()), item->grabPointer ? (int)QQuickEventPoint::GrabExclusive : (int)NoGrab, eventPos(point), point->scenePosition())); } @@ -218,7 +218,7 @@ public: EventItem *item = qmlobject_cast<EventItem *>(target()); if (item) item->eventList.append(Event(Event::HandlerDestination, QEvent::None, - static_cast<Qt::TouchPointState>(point->state()), stateChange, eventPos(point), point->scenePosition())); + static_cast<QEventPoint::State>(point->state()), stateChange, eventPos(point), point->scenePosition())); } int pressEventCount = 0; @@ -248,16 +248,16 @@ private slots: protected: bool eventFilter(QObject *, QEvent *event) { - Qt::TouchPointState tpState; + QEventPoint::State tpState; switch (event->type()) { case QEvent::MouseButtonPress: - tpState = Qt::TouchPointPressed; + tpState = QEventPoint::State::Pressed; break; case QEvent::MouseMove: - tpState = Qt::TouchPointMoved; + tpState = QEventPoint::State::Updated; break; case QEvent::MouseButtonRelease: - tpState = Qt::TouchPointReleased; + tpState = QEventPoint::State::Released; break; default: // So far we aren't recording filtered touch events here - they would be quite numerous in some cases @@ -320,19 +320,19 @@ void tst_PointerHandlers::touchEventDelivery() QTest::touchEvent(window, touchDevice).press(0, p1, window); QQuickTouchUtils::flush(window); QTRY_COMPARE(eventItem1->eventList.size(), synthMouse ? 3 : 2); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, NoGrab); - QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, Qt::TouchPointPressed, NoGrab); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, NoGrab); + QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, QEventPoint::State::Pressed, NoGrab); if (synthMouse) - QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseButtonPress, Qt::TouchPointPressed, NoGrab); + QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseButtonPress, QEventPoint::State::Pressed, NoGrab); p1 += QPoint(10, 0); QTest::touchEvent(window, touchDevice).move(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), synthMouse ? 4 : 3); - QCOMPARE_EVENT(eventItem1->eventList.size() - 1, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointMoved, NoGrab); + QCOMPARE_EVENT(eventItem1->eventList.size() - 1, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Updated, NoGrab); QTest::touchEvent(window, touchDevice).release(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), synthMouse ? 5 : 4); - QCOMPARE_EVENT(eventItem1->eventList.size() - 1, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointReleased, NoGrab); + QCOMPARE_EVENT(eventItem1->eventList.size() - 1, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Released, NoGrab); eventItem1->eventList.clear(); // Accept touch @@ -341,21 +341,21 @@ void tst_PointerHandlers::touchEventDelivery() QTest::touchEvent(window, touchDevice).press(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 2); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, NoGrab); - QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, NoGrab); + QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, QEventPoint::State::Pressed, QQuickEventPoint::GrabExclusive); auto pointerEvent = QQuickWindowPrivate::get(window)->pointerEventInstance(touchDevice); QCOMPARE(pointerEvent->point(0)->exclusiveGrabber(), eventItem1); p1 += QPoint(10, 0); QTest::touchEvent(window, touchDevice).move(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 4); - QCOMPARE_EVENT(2, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointMoved, NoGrab); - QCOMPARE_EVENT(3, Event::TouchDestination, QEvent::TouchUpdate, Qt::TouchPointMoved, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(2, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Updated, NoGrab); + QCOMPARE_EVENT(3, Event::TouchDestination, QEvent::TouchUpdate, QEventPoint::State::Updated, QQuickEventPoint::GrabExclusive); QTest::touchEvent(window, touchDevice).release(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 6); - QCOMPARE_EVENT(4, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointReleased, NoGrab); - QCOMPARE_EVENT(5, Event::TouchDestination, QEvent::TouchEnd, Qt::TouchPointReleased, NoGrab); + QCOMPARE_EVENT(4, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Released, NoGrab); + QCOMPARE_EVENT(5, Event::TouchDestination, QEvent::TouchEnd, QEventPoint::State::Released, NoGrab); eventItem1->eventList.clear(); // wait to avoid getting a double click event @@ -369,10 +369,10 @@ void tst_PointerHandlers::touchEventDelivery() QTest::touchEvent(window, touchDevice).press(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), synthMouse ? 3 : 2); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, NoGrab); - QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, Qt::TouchPointPressed, NoGrab); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, NoGrab); + QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, QEventPoint::State::Pressed, NoGrab); if (synthMouse) - QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseButtonPress, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseButtonPress, QEventPoint::State::Pressed, QQuickEventPoint::GrabExclusive); QCOMPARE(window->mouseGrabberItem(), synthMouse ? eventItem1 : nullptr); QPointF localPos = eventItem1->mapFromScene(p1); @@ -389,20 +389,20 @@ void tst_PointerHandlers::touchEventDelivery() QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), synthMouse ? 6 : 3); if (synthMouse) { - QCOMPARE_EVENT(3, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointMoved, NoGrab); - QCOMPARE_EVENT(4, Event::TouchDestination, QEvent::TouchUpdate, Qt::TouchPointMoved, NoGrab); - QCOMPARE_EVENT(5, Event::MouseDestination, QEvent::MouseMove, Qt::TouchPointMoved, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(3, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Updated, NoGrab); + QCOMPARE_EVENT(4, Event::TouchDestination, QEvent::TouchUpdate, QEventPoint::State::Updated, NoGrab); + QCOMPARE_EVENT(5, Event::MouseDestination, QEvent::MouseMove, QEventPoint::State::Updated, QQuickEventPoint::GrabExclusive); } QTest::touchEvent(window, touchDevice).release(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), synthMouse ? 10 : 4); if (synthMouse) { - QCOMPARE_EVENT(6, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointReleased, NoGrab); - QCOMPARE_EVENT(7, Event::TouchDestination, QEvent::TouchEnd, Qt::TouchPointReleased, NoGrab); - QCOMPARE_EVENT(8, Event::MouseDestination, QEvent::MouseButtonRelease, Qt::TouchPointReleased, NoGrab); - QCOMPARE_EVENT(9, Event::MouseDestination, QEvent::UngrabMouse, Qt::TouchPointReleased, QQuickEventPoint::UngrabExclusive); + QCOMPARE_EVENT(6, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Released, NoGrab); + QCOMPARE_EVENT(7, Event::TouchDestination, QEvent::TouchEnd, QEventPoint::State::Released, NoGrab); + QCOMPARE_EVENT(8, Event::MouseDestination, QEvent::MouseButtonRelease, QEventPoint::State::Released, NoGrab); + QCOMPARE_EVENT(9, Event::MouseDestination, QEvent::UngrabMouse, QEventPoint::State::Released, QQuickEventPoint::UngrabExclusive); } else { - QCOMPARE_EVENT(3, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointReleased, NoGrab); + QCOMPARE_EVENT(3, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Released, NoGrab); } eventItem1->eventList.clear(); @@ -417,10 +417,10 @@ void tst_PointerHandlers::touchEventDelivery() QTest::touchEvent(window, touchDevice).press(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), synthMouse ? 3 : 2); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, NoGrab); - QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, Qt::TouchPointPressed, NoGrab); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, NoGrab); + QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, QEventPoint::State::Pressed, NoGrab); if (synthMouse) - QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseButtonPress, Qt::TouchPointPressed, NoGrab); + QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseButtonPress, QEventPoint::State::Pressed, NoGrab); QCOMPARE(pointerEvent->point(0)->exclusiveGrabber(), nullptr); p1 += QPoint(10, 0); QTest::touchEvent(window, touchDevice).move(0, p1, window); @@ -441,19 +441,19 @@ void tst_PointerHandlers::touchEventDelivery() QTest::touchEvent(window, touchDevice).press(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 2); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, NoGrab); - QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, NoGrab); + QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, QEventPoint::State::Pressed, QQuickEventPoint::GrabExclusive); p1 += QPoint(10, 0); QTest::touchEvent(window, touchDevice).move(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 4); - QCOMPARE_EVENT(2, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointMoved, NoGrab); - QCOMPARE_EVENT(3, Event::TouchDestination, QEvent::TouchUpdate, Qt::TouchPointMoved, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(2, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Updated, NoGrab); + QCOMPARE_EVENT(3, Event::TouchDestination, QEvent::TouchUpdate, QEventPoint::State::Updated, QQuickEventPoint::GrabExclusive); QTest::touchEvent(window, touchDevice).release(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 6); - QCOMPARE_EVENT(4, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointReleased, NoGrab); - QCOMPARE_EVENT(5, Event::TouchDestination, QEvent::TouchEnd, Qt::TouchPointReleased, NoGrab); + QCOMPARE_EVENT(4, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Released, NoGrab); + QCOMPARE_EVENT(5, Event::TouchDestination, QEvent::TouchEnd, QEventPoint::State::Released, NoGrab); eventItem1->eventList.clear(); // Accept pointer events @@ -463,19 +463,19 @@ void tst_PointerHandlers::touchEventDelivery() QTest::touchEvent(window, touchDevice).press(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 2); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::None, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive); - QCOMPARE_EVENT(1, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::None, QEventPoint::State::Pressed, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(1, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, QQuickEventPoint::GrabExclusive); p1 += QPoint(10, 0); QTest::touchEvent(window, touchDevice).move(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 3); - QCOMPARE_EVENT(2, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointMoved, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(2, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Updated, QQuickEventPoint::GrabExclusive); QTest::touchEvent(window, touchDevice).release(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 5); qCDebug(lcPointerTests) << eventItem1->eventList; - QCOMPARE_EVENT(3, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointReleased, QQuickEventPoint::GrabExclusive); - QCOMPARE_EVENT(4, Event::HandlerDestination, QEvent::None, Qt::TouchPointReleased, QQuickEventPoint::UngrabExclusive); + QCOMPARE_EVENT(3, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Released, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(4, Event::HandlerDestination, QEvent::None, QEventPoint::State::Released, QQuickEventPoint::UngrabExclusive); eventItem1->eventList.clear(); } @@ -509,8 +509,8 @@ void tst_PointerHandlers::mouseEventDelivery() p1 = QPoint(20, 20); QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, p1); QCOMPARE(eventItem1->eventList.size(), 2); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, NoGrab); - QCOMPARE_EVENT(1, Event::MouseDestination, QEvent::MouseButtonPress, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, NoGrab); + QCOMPARE_EVENT(1, Event::MouseDestination, QEvent::MouseButtonPress, QEventPoint::State::Pressed, QQuickEventPoint::GrabExclusive); QCOMPARE(window->mouseGrabberItem(), eventItem1); QPointF localPos = eventItem1->mapFromScene(p1); @@ -523,11 +523,11 @@ void tst_PointerHandlers::mouseEventDelivery() p1 += QPoint(10, 0); QTest::mouseMove(window, p1); QCOMPARE(eventItem1->eventList.size(), 3); - QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseMove, Qt::TouchPointMoved, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseMove, QEventPoint::State::Updated, QQuickEventPoint::GrabExclusive); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QCOMPARE(eventItem1->eventList.size(), 5); - QCOMPARE_EVENT(3, Event::MouseDestination, QEvent::MouseButtonRelease, Qt::TouchPointReleased, NoGrab); - QCOMPARE_EVENT(4, Event::MouseDestination, QEvent::UngrabMouse, Qt::TouchPointReleased, QQuickEventPoint::UngrabExclusive); + QCOMPARE_EVENT(3, Event::MouseDestination, QEvent::MouseButtonRelease, QEventPoint::State::Released, NoGrab); + QCOMPARE_EVENT(4, Event::MouseDestination, QEvent::UngrabMouse, QEventPoint::State::Released, QQuickEventPoint::UngrabExclusive); eventItem1->eventList.clear(); // wait to avoid getting a double click event @@ -540,17 +540,17 @@ void tst_PointerHandlers::mouseEventDelivery() p1 = QPoint(20, 20); QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_COMPARE(eventItem1->eventList.size(), 3); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::None, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive); - QCOMPARE_EVENT(1, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive); - QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseButtonPress, Qt::TouchPointPressed, 0); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::None, QEventPoint::State::Pressed, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(1, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseButtonPress, QEventPoint::State::Pressed, 0); p1 += QPoint(10, 0); QTest::mouseMove(window, p1); QCOMPARE(eventItem1->eventList.size(), 4); - QCOMPARE_EVENT(3, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointMoved, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(3, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Updated, QQuickEventPoint::GrabExclusive); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QCOMPARE(eventItem1->eventList.size(), 6); - QCOMPARE_EVENT(4, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointReleased, QQuickEventPoint::GrabExclusive); - QCOMPARE_EVENT(5, Event::HandlerDestination, QEvent::None, Qt::TouchPointReleased, QQuickEventPoint::UngrabExclusive); + QCOMPARE_EVENT(4, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Released, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(5, Event::HandlerDestination, QEvent::None, QEventPoint::State::Released, QQuickEventPoint::UngrabExclusive); eventItem1->eventList.clear(); } @@ -562,17 +562,17 @@ void tst_PointerHandlers::touchReleaseOutside_data() QTest::addColumn<int>("endIndexToTest"); QTest::addColumn<int>("endDestination"); // Event::Destination QTest::addColumn<int>("endType"); // QEvent::Type - QTest::addColumn<int>("endState"); // Qt::TouchPointState - QTest::addColumn<int>("endGrabState"); // Qt::TouchPointState + QTest::addColumn<int>("endState"); // QEventPoint::State + QTest::addColumn<int>("endGrabState"); // QEventPoint::State QTest::newRow("reject and ignore") << false << false << 6 << 5 << (int)Event::TouchDestination - << (int)QEvent::TouchEnd << (int)Qt::TouchPointReleased << (int)NoGrab; + << (int)QEvent::TouchEnd << (int)QEventPoint::State::Released << (int)NoGrab; QTest::newRow("reject and grab") << false << true << 5 << 4 << (int)Event::HandlerDestination - << (int)QEvent::None << (int)Qt::TouchPointReleased << (int)QQuickEventPoint::UngrabExclusive; + << (int)QEvent::None << (int)QEventPoint::State::Released << (int)QQuickEventPoint::UngrabExclusive; QTest::newRow("accept and ignore") << true << false << 1 << 0 << (int)Event::HandlerDestination - << (int)QEvent::Pointer << (int)Qt::TouchPointPressed << (int)NoGrab; + << (int)QEvent::Pointer << (int)QEventPoint::State::Pressed << (int)NoGrab; QTest::newRow("accept and grab") << true << true << 5 << 4 << (int)Event::HandlerDestination - << (int)QEvent::None << (int)Qt::TouchPointReleased << (int)QQuickEventPoint::UngrabExclusive; + << (int)QEvent::None << (int)QEventPoint::State::Released << (int)QQuickEventPoint::UngrabExclusive; } void tst_PointerHandlers::touchReleaseOutside() @@ -626,8 +626,8 @@ void tst_PointerHandlers::dynamicCreation() QPoint p1(20, 20); QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_COMPARE(eventItem1->eventList.size(), 2); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, NoGrab); - QCOMPARE_EVENT(1, Event::MouseDestination, QEvent::MouseButtonPress, Qt::TouchPointPressed, NoGrab); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, NoGrab); + QCOMPARE_EVENT(1, Event::MouseDestination, QEvent::MouseButtonPress, QEventPoint::State::Pressed, NoGrab); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); } diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index a3340c0e3a..f6a6ab17b4 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -92,7 +92,7 @@ public: int touchUpdates; int touchReleases; int ungrabs; - QVector<Qt::TouchPointState> touchPointStates; + QVector<QEventPoint::State> touchPointStates; protected: void touchEvent(QTouchEvent *ev) override @@ -100,21 +100,21 @@ protected: QCOMPARE(ev->touchPoints().count(), 1); auto touchpoint = ev->touchPoints().first(); switch (touchpoint.state()) { - case Qt::TouchPointPressed: + case QEventPoint::State::Pressed: QVERIFY(!m_active); m_active = true; emit activeChanged(); grabTouchPoints(QList<int>() << touchpoint.id()); break; - case Qt::TouchPointMoved: + case QEventPoint::State::Updated: ++touchUpdates; break; - case Qt::TouchPointReleased: + case QEventPoint::State::Released: QVERIFY(m_active); m_active = false; ++touchReleases; emit activeChanged(); - case Qt::TouchPointStationary: + case QEventPoint::State::Stationary: break; } touchPointStates << touchpoint.state(); @@ -2068,7 +2068,7 @@ void tst_qquickflickable::nestedSliderUsingTouch() QCOMPARE(tda->active(), !ungrabs); QTest::touchEvent(window, touchDevice).release(0, p0, window); QQuickTouchUtils::flush(window); - QTRY_COMPARE(tda->touchPointStates.first(), Qt::TouchPointPressed); + QTRY_COMPARE(tda->touchPointStates.first(), QEventPoint::State::Pressed); QTRY_VERIFY(tda->touchUpdates >= minUpdates); QTRY_COMPARE(tda->touchReleases, releases); QTRY_COMPARE(tda->ungrabs, ungrabs); diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp index 924a1d2c4e..0e7ab12074 100644 --- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp @@ -1341,16 +1341,16 @@ void tst_qquickitem::touchEventAcceptIgnore() // Send Begin, Update & End touch sequence { - QTouchEvent::TouchPoint point; + QEventPoint point; point.setId(1); point.setPos(QPointF(50, 50)); point.setScreenPos(point.position()); - point.setState(Qt::TouchPointPressed); + point.setState(QEventPoint::State::Pressed); QTouchEvent event(QEvent::TouchBegin, device, Qt::NoModifier, - Qt::TouchPointPressed, - QList<QTouchEvent::TouchPoint>() << point); + QEventPoint::State::Pressed, + QList<QEventPoint>() << point); event.setAccepted(true); item->touchEventReached = false; @@ -1365,16 +1365,16 @@ void tst_qquickitem::touchEventAcceptIgnore() QCOMPARE(accepted && event.isAccepted(), true); } { - QTouchEvent::TouchPoint point; + QEventPoint point; point.setId(1); point.setPos(QPointF(60, 60)); point.setScreenPos(point.position()); - point.setState(Qt::TouchPointMoved); + point.setState(QEventPoint::State::Updated); QTouchEvent event(QEvent::TouchUpdate, device, Qt::NoModifier, - Qt::TouchPointMoved, - QList<QTouchEvent::TouchPoint>() << point); + QEventPoint::State::Updated, + QList<QEventPoint>() << point); event.setAccepted(true); item->touchEventReached = false; @@ -1389,16 +1389,16 @@ void tst_qquickitem::touchEventAcceptIgnore() QCOMPARE(accepted && event.isAccepted(), true); } { - QTouchEvent::TouchPoint point; + QEventPoint point; point.setId(1); point.setPos(QPointF(60, 60)); point.setScreenPos(point.position()); - point.setState(Qt::TouchPointReleased); + point.setState(QEventPoint::State::Released); QTouchEvent event(QEvent::TouchEnd, device, Qt::NoModifier, - Qt::TouchPointReleased, - QList<QTouchEvent::TouchPoint>() << point); + QEventPoint::State::Released, + QList<QEventPoint>() << point); event.setAccepted(true); item->touchEventReached = false; diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp index 04a44a2c10..0806914763 100644 --- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp +++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp @@ -1373,10 +1373,10 @@ void tst_QQuickMultiPointTouchArea::stationaryTouchWithChangingPressure() // QTB QCOMPARE(point1->pressed(), false); QPoint p1(20,100); - QTouchEvent::TouchPoint tp1(1); + QEventPoint tp1(1); tp1.setScreenPos(window->mapToGlobal(p1)); - tp1.setState(Qt::TouchPointPressed); + tp1.setState(QEventPoint::State::Pressed); tp1.setPressure(0.5); qt_handleTouchEvent(window.data(), device, {tp1}); QQuickTouchUtils::flush(window.data()); @@ -1384,14 +1384,14 @@ void tst_QQuickMultiPointTouchArea::stationaryTouchWithChangingPressure() // QTB QCOMPARE(point1->pressed(), true); QCOMPARE(point1->pressure(), 0.5); - tp1.setState(Qt::TouchPointStationary); + tp1.setState(QEventPoint::State::Stationary); tp1.setPressure(0.6); qt_handleTouchEvent(window.data(), device, {tp1}); QQuickTouchUtils::flush(window.data()); QCOMPARE(point1->pressure(), 0.6); - tp1.setState(Qt::TouchPointReleased); + tp1.setState(QEventPoint::State::Released); tp1.setPressure(0); qt_handleTouchEvent(window.data(), device, {tp1}); QQuickTouchUtils::flush(window.data()); diff --git a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp index 3213d49dd5..b65e12d2be 100644 --- a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp +++ b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp @@ -175,9 +175,9 @@ void tst_QQuickPinchArea::pinchProperties() QCOMPARE(rotMaxSpy.count(),1); } -QTouchEvent::TouchPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickItem *i) +QEventPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickItem *i) { - QTouchEvent::TouchPoint touchPoint(id); + QEventPoint touchPoint(id); touchPoint.setPos(i->mapFromScene(p)); touchPoint.setScreenPos(v->mapToGlobal(p)); touchPoint.setScenePos(p); diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index ecb2b7a4a9..ef304894bc 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -64,15 +64,15 @@ struct TouchEventData { QEvent::Type type; QWidget *widget; QWindow *window; - Qt::TouchPointStates states; - QList<QTouchEvent::TouchPoint> touchPoints; + QEventPoint::States states; + QList<QEventPoint> touchPoints; }; -static QTouchEvent::TouchPoint makeTouchPoint(QQuickItem *item, const QPointF &p, const QPointF &lastPoint = QPointF()) +static QEventPoint makeTouchPoint(QQuickItem *item, const QPointF &p, const QPointF &lastPoint = QPointF()) { QPointF last = lastPoint.isNull() ? p : lastPoint; - QTouchEvent::TouchPoint tp; + QEventPoint tp; tp.setPos(p); tp.setLastPos(last); @@ -83,15 +83,15 @@ static QTouchEvent::TouchPoint makeTouchPoint(QQuickItem *item, const QPointF &p return tp; } -static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, Qt::TouchPointStates states = {}, - const QList<QTouchEvent::TouchPoint>& touchPoints = QList<QTouchEvent::TouchPoint>()) +static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, QEventPoint::States states = {}, + const QList<QEventPoint>& touchPoints = QList<QEventPoint>()) { TouchEventData d = { type, nullptr, w, states, touchPoints }; return d; } -static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, Qt::TouchPointStates states, const QTouchEvent::TouchPoint &touchPoint) +static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, QEventPoint::States states, const QEventPoint &touchPoint) { - QList<QTouchEvent::TouchPoint> points; + QList<QEventPoint> points; points << touchPoint; return makeTouchData(type, w, states, points); } @@ -167,7 +167,7 @@ public: setEnabled(true); setVisible(true); - lastEvent = makeTouchData(QEvent::None, window(), {}, QList<QTouchEvent::TouchPoint>());//CHECK_VALID + lastEvent = makeTouchData(QEvent::None, window(), {}, QList<QEventPoint>());//CHECK_VALID lastVelocity = lastVelocityFromMouseMove = QVector2D(); lastMousePos = QPointF(); @@ -213,7 +213,7 @@ public: } else { lastVelocity = QVector2D(); } - if (spinLoopWhenPressed && event->touchPointStates().testFlag(Qt::TouchPointPressed)) { + if (spinLoopWhenPressed && event->touchPointStates().testFlag(QEventPoint::State::Pressed)) { QCoreApplication::processEvents(); } } @@ -649,7 +649,7 @@ void tst_qquickwindow::touchEvent_basic() QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty()); // At one point this was failing with kwin (KDE window manager) because window->setPosition(100, 100) // would put the decorated window at that position rather than the window itself. - COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(topItem, pos))); + COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(topItem, pos))); topItem->reset(); touchSeq.release(0, topItem->mapToScene(pos).toPoint(), window).commit(); @@ -660,8 +660,8 @@ void tst_qquickwindow::touchEvent_basic() QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1); - COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(topItem, pos))); - COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(bottomItem, pos))); + COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(topItem, pos))); + COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(bottomItem, pos))); topItem->reset(); bottomItem->reset(); touchSeq.release(0, topItem->mapToScene(pos).toPoint(), window).release(1, bottomItem->mapToScene(pos).toPoint(), window).commit(); @@ -672,7 +672,7 @@ void tst_qquickwindow::touchEvent_basic() touchSeq.move(0, bottomItem->mapToScene(pos).toPoint(), window).commit(); QQuickTouchUtils::flush(window); QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); - COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchUpdate, window, Qt::TouchPointMoved, + COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchUpdate, window, QEventPoint::State::Updated, makeTouchPoint(topItem, topItem->mapFromItem(bottomItem, pos), pos))); topItem->reset(); touchSeq.release(0, bottomItem->mapToScene(pos).toPoint(), window).commit(); @@ -683,7 +683,7 @@ void tst_qquickwindow::touchEvent_basic() touchSeq.move(0, topItem->mapToScene(pos).toPoint(), window).commit(); QQuickTouchUtils::flush(window); QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1); - COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchUpdate, window, Qt::TouchPointMoved, + COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchUpdate, window, QEventPoint::State::Updated, makeTouchPoint(bottomItem, bottomItem->mapFromItem(topItem, pos), pos))); bottomItem->reset(); touchSeq.release(0, bottomItem->mapToScene(pos).toPoint(), window).commit(); @@ -697,8 +697,8 @@ void tst_qquickwindow::touchEvent_basic() QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); // received press only, not stationary QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1); - COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(topItem, pos))); - COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(bottomItem, pos))); + COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(topItem, pos))); + COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(bottomItem, pos))); topItem->reset(); bottomItem->reset(); // cleanup: what is pressed must be released @@ -713,7 +713,7 @@ void tst_qquickwindow::touchEvent_basic() touchSeq.release(0, bottomItem->mapToScene(pos).toPoint(),window).commit(); QQuickTouchUtils::flush(window); QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); - COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchEnd, window, Qt::TouchPointReleased, + COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchEnd, window, QEventPoint::State::Released, makeTouchPoint(topItem, topItem->mapFromItem(bottomItem, pos), pos))); topItem->reset(); @@ -729,9 +729,9 @@ void tst_qquickwindow::touchEvent_basic() QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1); - COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchEnd, window, Qt::TouchPointReleased, + COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchEnd, window, QEventPoint::State::Released, makeTouchPoint(topItem, topItem->mapFromItem(bottomItem, pos)))); - COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(bottomItem, pos))); + COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(bottomItem, pos))); topItem->reset(); bottomItem->reset(); @@ -788,7 +788,7 @@ void tst_qquickwindow::touchEvent_propagation() QTRY_COMPARE(middleItem->lastEvent.touchPoints.count(), 1); QVERIFY(topItem->lastEvent.touchPoints.isEmpty()); QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty()); - COMPARE_TOUCH_DATA(middleItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, + COMPARE_TOUCH_DATA(middleItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(middleItem, middleItem->mapFromItem(topItem, pos)))); QTest::touchEvent(window, touchDevice).release(0, pointInTopItem, window); @@ -798,8 +798,8 @@ void tst_qquickwindow::touchEvent_propagation() QTRY_COMPARE(middleItem->lastEvent.touchPoints.count(), 2); QVERIFY(topItem->lastEvent.touchPoints.isEmpty()); QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty()); - COMPARE_TOUCH_DATA(middleItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, - (QList<QTouchEvent::TouchPoint>() << makeTouchPoint(middleItem, middleItem->mapFromItem(topItem, pos)) + COMPARE_TOUCH_DATA(middleItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, + (QList<QEventPoint>() << makeTouchPoint(middleItem, middleItem->mapFromItem(topItem, pos)) << makeTouchPoint(middleItem, pos) ))); QTest::touchEvent(window, touchDevice).release(0, pointInTopItem, window) .release(1, pointInMiddleItem, window); @@ -817,8 +817,8 @@ void tst_qquickwindow::touchEvent_propagation() QTRY_COMPARE(bottomItem->lastEvent.touchPoints.count(), 2); QVERIFY(topItem->lastEvent.touchPoints.isEmpty()); QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); - COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, - (QList<QTouchEvent::TouchPoint>() << makeTouchPoint(bottomItem, bottomItem->mapFromItem(topItem, pos)) + COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, + (QList<QEventPoint>() << makeTouchPoint(bottomItem, bottomItem->mapFromItem(topItem, pos)) << makeTouchPoint(bottomItem, bottomItem->mapFromItem(middleItem, pos)) ))); bottomItem->reset(); @@ -855,14 +855,14 @@ void tst_qquickwindow::touchEvent_propagation() QVERIFY(topItem->lastEvent.touchPoints.isEmpty()); QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1); - COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, + COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(bottomItem, bottomItem->mapFromItem(topItem, pos)))); } else { // middle item ignores event, sends it to the top item (top-most child) QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty()); - COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, + COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(topItem, pos))); } QTest::touchEvent(window, touchDevice).release(0, pointInTopItem, window); @@ -906,7 +906,7 @@ void tst_qquickwindow::touchEvent_cancel() QCoreApplication::processEvents(); QTRY_COMPARE(item->lastEvent.touchPoints.count(), 1); - TouchEventData d = makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(item, pos)); + TouchEventData d = makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(item, pos)); COMPARE_TOUCH_DATA(item->lastEvent, d); item->reset(); @@ -1006,10 +1006,10 @@ void tst_qquickwindow::touchEvent_velocity() item->setPosition(QPointF(50, 50)); item->setSize(QSizeF(150, 150)); - QList<QTouchEvent::TouchPoint> points; - QTouchEvent::TouchPoint tp; + QList<QEventPoint> points; + QEventPoint tp; tp.setId(1); - tp.setState(Qt::TouchPointPressed); + tp.setState(QEventPoint::State::Pressed); const QPointF localPos = item->mapToScene(QPointF(10, 10)); const QPointF screenPos = window->mapToGlobal(localPos.toPoint()); tp.setPos(localPos); @@ -1022,7 +1022,7 @@ void tst_qquickwindow::touchEvent_velocity() QQuickTouchUtils::flush(window); QCOMPARE(item->touchEventCount, 1); - points[0].setState(Qt::TouchPointMoved); + points[0].setState(QEventPoint::State::Updated); points[0].setPos(localPos + QPointF(5, 5)); points[0].setScreenPos(screenPos + QPointF(5, 5)); QVector2D velocity(1.5, 2.5); @@ -1051,7 +1051,7 @@ void tst_qquickwindow::touchEvent_velocity() QPoint itemLocalPosFromEvent = item->lastEvent.touchPoints[0].position().toPoint(); QCOMPARE(itemLocalPos, itemLocalPosFromEvent); - points[0].setState(Qt::TouchPointReleased); + points[0].setState(QEventPoint::State::Released); QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window)); QGuiApplication::processEvents(); @@ -1150,10 +1150,10 @@ void tst_qquickwindow::mouseFromTouch_basic() item->setSize(QSizeF(150, 150)); item->acceptTouchEvents = false; - QList<QTouchEvent::TouchPoint> points; - QTouchEvent::TouchPoint tp; + QList<QEventPoint> points; + QEventPoint tp; tp.setId(1); - tp.setState(Qt::TouchPointPressed); + tp.setState(QEventPoint::State::Pressed); const QPointF localPos = item->mapToScene(QPointF(10, 10)); const QPointF screenPos = window->mapToGlobal(localPos.toPoint()); tp.setPos(localPos); @@ -1164,7 +1164,7 @@ void tst_qquickwindow::mouseFromTouch_basic() QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window)); QGuiApplication::processEvents(); QQuickTouchUtils::flush(window); - points[0].setState(Qt::TouchPointMoved); + points[0].setState(QEventPoint::State::Updated); points[0].setPos(localPos + QPointF(5, 5)); points[0].setScreenPos(screenPos + QPointF(5, 5)); QVector2D velocity(1.5, 2.5); @@ -1173,7 +1173,7 @@ void tst_qquickwindow::mouseFromTouch_basic() QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window)); QGuiApplication::processEvents(); QQuickTouchUtils::flush(window); - points[0].setState(Qt::TouchPointReleased); + points[0].setState(QEventPoint::State::Released); QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window)); QGuiApplication::processEvents(); @@ -1192,7 +1192,7 @@ void tst_qquickwindow::mouseFromTouch_basic() QMatrix4x4 transformMatrix; transformMatrix.rotate(-90, 0, 0, 1); // counterclockwise QVector2D transformedVelocity = transformMatrix.mapVector(velocity).toVector2D(); - points[0].setState(Qt::TouchPointPressed); + points[0].setState(QEventPoint::State::Pressed); points[0].setVelocity(velocity); tp.setPos(localPos); tp.setScreenPos(screenPos); @@ -1200,7 +1200,7 @@ void tst_qquickwindow::mouseFromTouch_basic() QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window)); QGuiApplication::processEvents(); QQuickTouchUtils::flush(window); - points[0].setState(Qt::TouchPointMoved); + points[0].setState(QEventPoint::State::Updated); points[0].setPos(localPos + QPointF(5, 5)); points[0].setScreenPos(screenPos + QPointF(5, 5)); QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, @@ -1210,7 +1210,7 @@ void tst_qquickwindow::mouseFromTouch_basic() QCOMPARE(item->lastMousePos.toPoint(), item->mapFromScene(points[0].position()).toPoint()); QCOMPARE(item->lastVelocityFromMouseMove, transformedVelocity); - points[0].setState(Qt::TouchPointReleased); + points[0].setState(QEventPoint::State::Released); QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window)); QCoreApplication::processEvents(); @@ -2846,8 +2846,8 @@ void tst_qquickwindow::pointerEventTypeAndPointCount() QPointF screenPosition(333, 366); QMouseEvent me(QEvent::MouseButtonPress, localPosition, scenePosition, screenPosition, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - QTouchEvent te(QEvent::TouchBegin, touchDevice, Qt::NoModifier, Qt::TouchPointPressed, - QList<QTouchEvent::TouchPoint>() << QTouchEvent::TouchPoint(1)); + QTouchEvent te(QEvent::TouchBegin, touchDevice, Qt::NoModifier, QEventPoint::State::Pressed, + QList<QEventPoint>() << QEventPoint(1)); QQuickPointerMouseEvent pme(nullptr, QPointingDevice::primaryPointingDevice()); @@ -2874,14 +2874,14 @@ void tst_qquickwindow::pointerEventTypeAndPointCount() QCOMPARE(pte.touchPointById(1)->id(), 1); QVERIFY(!pte.touchPointById(0)); - te.setTouchPoints(QList<QTouchEvent::TouchPoint>() << QTouchEvent::TouchPoint(1) << QTouchEvent::TouchPoint(2)); + te.setTouchPoints(QList<QEventPoint>() << QEventPoint(1) << QEventPoint(2)); pte.reset(&te); QCOMPARE(pte.pointCount(), 2); QCOMPARE(pte.touchPointById(1)->id(), 1); QCOMPARE(pte.touchPointById(2)->id(), 2); QVERIFY(!pte.touchPointById(0)); - te.setTouchPoints(QList<QTouchEvent::TouchPoint>() << QTouchEvent::TouchPoint(2)); + te.setTouchPoints(QList<QEventPoint>() << QEventPoint(2)); pte.reset(&te); QCOMPARE(pte.pointCount(), 1); QCOMPARE(pte.touchPointById(2)->id(), 2); diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index 88348b8889..bd838d8d61 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -56,14 +56,14 @@ struct Event :type(t), mousePos(mouse), mousePosGlobal(global) {} - Event(QEvent::Type t, QList<QTouchEvent::TouchPoint> touch) + Event(QEvent::Type t, QList<QEventPoint> touch) :type(t), points(touch) {} QEvent::Type type; QPoint mousePos; QPoint mousePosGlobal; - QList<QTouchEvent::TouchPoint> points; + QList<QEventPoint> points; }; #ifndef QT_NO_DEBUG_STREAM @@ -101,7 +101,7 @@ public: void touchEvent(QTouchEvent *event) { eventList.append(Event(event->type(), event->touchPoints())); - QList<QTouchEvent::TouchPoint> tps = event->touchPoints(); + QList<QEventPoint> tps = event->touchPoints(); Q_ASSERT(!tps.isEmpty()); point0 = tps.first().id(); event->setAccepted(acceptTouch); @@ -156,7 +156,7 @@ public: event->type() == QEvent::TouchEnd) { QTouchEvent *touch = static_cast<QTouchEvent*>(event); eventList.append(Event(event->type(), touch->touchPoints())); - QList<QTouchEvent::TouchPoint> tps = touch->touchPoints(); + QList<QEventPoint> tps = touch->touchPoints(); Q_ASSERT(!tps.isEmpty()); point0 = tps.first().id(); if (filterTouch) |