From 875a7fad52e88a86eb963b534e9a7c3e27d7e7ce Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 21 Oct 2020 14:01:49 +0200 Subject: Fix a bunch of compiler warnings in event handling test cases Leave the normalizedPos warnings, there is no equivalent function. Change-Id: I50c72ab24b4855e36941aafdee30cdb0e94c1684 Reviewed-by: Friedemann Kleint Reviewed-by: Shawn Rutledge --- .../auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp | 21 ++++++++++++--------- .../qgraphicsitem/tst_qgraphicsitem.cpp | 4 ++-- .../qgraphicsscene/tst_qgraphicsscene.cpp | 20 ++++++++++---------- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 2 +- 4 files changed, 25 insertions(+), 22 deletions(-) (limited to 'tests') diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp index dd36a28854..8d07718156 100644 --- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp @@ -78,9 +78,9 @@ public: if (seenTouchEnd) qWarning("TouchBegin: TouchEnd cannot happen before TouchBegin"); seenTouchBegin = !seenTouchBegin && !seenTouchUpdate && !seenTouchEnd; auto touchEvent = static_cast(event); - touchBeginPoints = touchEvent->touchPoints(); + touchBeginPoints = touchEvent->points(); Q_ASSERT(touchBeginPoints.first().device() == touchEvent->pointingDevice()); - for (const QEventPoint &pt : touchEvent->touchPoints()) + for (const QEventPoint &pt : qAsConst(touchBeginPoints)) lastNormalizedPositions << pt.normalizedPos(); timestamp = touchEvent->timestamp(); deviceFromEvent = touchEvent->pointingDevice(); @@ -95,8 +95,8 @@ public: if (seenTouchEnd) qWarning("TouchUpdate: TouchEnd cannot happen before TouchUpdate"); seenTouchUpdate = seenTouchBegin && !seenTouchEnd; auto touchEvent = static_cast(event); - touchUpdatePoints = touchEvent->touchPoints(); - for (const QEventPoint &pt : touchEvent->touchPoints()) + touchUpdatePoints = touchEvent->points(); + for (const QEventPoint &pt : qAsConst(touchUpdatePoints)) lastNormalizedPositions << pt.normalizedPos(); timestamp = touchEvent->timestamp(); deviceFromEvent = touchEvent->pointingDevice(); @@ -111,8 +111,8 @@ public: if (seenTouchEnd) qWarning("TouchEnd: already seen a TouchEnd"); seenTouchEnd = seenTouchBegin && !seenTouchEnd; auto touchEvent = static_cast(event); - touchEndPoints = touchEvent->touchPoints(); - for (const QEventPoint &pt : touchEvent->touchPoints()) + touchEndPoints = touchEvent->points(); + for (const QEventPoint &pt : qAsConst(touchEndPoints)) lastNormalizedPositions << pt.normalizedPos(); timestamp = touchEvent->timestamp(); deviceFromEvent = touchEvent->pointingDevice(); @@ -177,7 +177,7 @@ public: if (seenTouchEnd) qWarning("TouchBegin: TouchEnd cannot happen before TouchBegin"); seenTouchBegin = !seenTouchBegin && !seenTouchUpdate && !seenTouchEnd; ++touchBeginCounter; - touchBeginPoints = static_cast(event)->touchPoints(); + touchBeginPoints = static_cast(event)->points(); event->setAccepted(acceptTouchBegin); if (deleteInTouchBegin) delete this; @@ -188,7 +188,7 @@ public: if (seenTouchEnd) qWarning("TouchUpdate: TouchEnd cannot happen before TouchUpdate"); seenTouchUpdate = seenTouchBegin && !seenTouchEnd; ++touchUpdateCounter; - touchUpdatePoints = static_cast(event)->touchPoints(); + touchUpdatePoints = static_cast(event)->points(); event->setAccepted(acceptTouchUpdate); if (deleteInTouchUpdate) delete this; @@ -199,7 +199,7 @@ public: if (seenTouchEnd) qWarning("TouchEnd: already seen a TouchEnd"); seenTouchEnd = seenTouchBegin && !seenTouchEnd; ++touchEndCounter; - touchEndPoints = static_cast(event)->touchPoints(); + touchEndPoints = static_cast(event)->points(); event->setAccepted(acceptTouchEnd); if (deleteInTouchEnd) delete this; @@ -363,6 +363,9 @@ void tst_QTouchEvent::state() QVERIFY(!touchEvent.isBeginEvent()); QVERIFY(!touchEvent.isUpdateEvent()); QVERIFY(touchEvent.isEndEvent()); + QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED // test Qt 5 compatibility wrappers + QCOMPARE(touchEvent.touchPoints(), touchEvent.points()); + QT_WARNING_POP } void tst_QTouchEvent::touchDisabledByDefault() diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 280b12b173..ab89a94a10 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -10989,11 +10989,11 @@ protected: { switch (ev->type()) { case QEvent::TouchBegin: - m_touchBeginPoints.append(static_cast(ev)->touchPoints().constFirst()); + m_touchBeginPoints.append(static_cast(ev)->points().constFirst()); ev->accept(); return true; case QEvent::TouchUpdate: - m_touchUpdatePoints.append(static_cast(ev)->touchPoints().constFirst()); + m_touchUpdatePoints.append(static_cast(ev)->points().constFirst()); ev->accept(); return true; default: diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 94130e25bf..21f1bee537 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -2281,8 +2281,8 @@ void tst_QGraphicsScene::dragAndDrop_simple() QCOMPARE(item->eventList.size(), 2); QCOMPARE(item->eventList.at(0), QEvent::GraphicsSceneDragEnter); QCOMPARE(item->eventList.at(1), QEvent::GraphicsSceneDragMove); - QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(dragMove.pos())); - QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(dragMove.pos())); + QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(dragMove.position().toPoint())); + QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(dragMove.position().toPoint())); QVERIFY(item->lastEvent->isAccepted()); QCOMPARE(item->lastEvent->dropAction(), Qt::IgnoreAction); } @@ -2294,8 +2294,8 @@ void tst_QGraphicsScene::dragAndDrop_simple() QCOMPARE(dragMove.dropAction(), Qt::IgnoreAction); QCOMPARE(item->eventList.size(), 3); QCOMPARE(item->eventList.at(2), QEvent::GraphicsSceneDragMove); - QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(dragMove.pos())); - QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(dragMove.pos())); + QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(dragMove.position().toPoint())); + QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(dragMove.position().toPoint())); QVERIFY(item->lastEvent->isAccepted()); QCOMPARE(item->lastEvent->dropAction(), Qt::IgnoreAction); } @@ -2307,8 +2307,8 @@ void tst_QGraphicsScene::dragAndDrop_simple() QCOMPARE(dragMove.dropAction(), Qt::CopyAction); QCOMPARE(item->eventList.size(), 4); QCOMPARE(item->eventList.at(3), QEvent::GraphicsSceneDragLeave); - QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(dragMove.pos())); - QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(dragMove.pos())); + QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(dragMove.position().toPoint())); + QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(dragMove.position().toPoint())); QVERIFY(item->lastEvent->isAccepted()); QCOMPARE(item->lastEvent->dropAction(), Qt::CopyAction); } @@ -2321,8 +2321,8 @@ void tst_QGraphicsScene::dragAndDrop_simple() QCOMPARE(item->eventList.size(), 6); QCOMPARE(item->eventList.at(4), QEvent::GraphicsSceneDragEnter); QCOMPARE(item->eventList.at(5), QEvent::GraphicsSceneDragMove); - QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(dragMove.pos())); - QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(dragMove.pos())); + QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(dragMove.position().toPoint())); + QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(dragMove.position().toPoint())); QVERIFY(item->lastEvent->isAccepted()); QCOMPARE(item->lastEvent->dropAction(), Qt::IgnoreAction); } @@ -2334,8 +2334,8 @@ void tst_QGraphicsScene::dragAndDrop_simple() QCOMPARE(drop.dropAction(), Qt::CopyAction); QCOMPARE(item->eventList.size(), 7); QCOMPARE(item->eventList.at(6), QEvent::GraphicsSceneDrop); - QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(drop.pos())); - QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(drop.pos())); + QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(drop.position().toPoint())); + QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(drop.position().toPoint())); QVERIFY(item->lastEvent->isAccepted()); QCOMPARE(item->lastEvent->dropAction(), Qt::CopyAction); } diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index dbeebfa523..7c42937a46 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -11495,7 +11495,7 @@ public: protected: void tabletEvent(QTabletEvent *event) override { ++tabletEventCount; - uid = event->uniqueId(); + uid = event->pointingDevice()->uniqueId().numericId(); switch (event->type()) { case QEvent::TabletMove: ++moveEventCount; -- cgit v1.2.3