From 37d5aaa4b42f9c837f0d27edb9da2185971d02be Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 11 Jun 2020 09:24:12 +0200 Subject: Change QWindow/QWidget::map(To/From)(Global/Parent) to operate in float Change the functions to operate in float and add the QPoint versions as overload calling them. This is more in-line with the event accessors using float and allows for removing some workarounds using a delta when converting touch points. Leave QPlatformWindow::map(To/From)Global() as is for now and add helpers for float. Change-Id: I2d46b8dbda8adff26539e358074b55073dc80b6f Reviewed-by: Shawn Rutledge Reviewed-by: Volker Hilsheimer --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/auto/widgets/kernel/qwidget') diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 6e9224cb5f..1ec296211f 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -1608,6 +1608,8 @@ void tst_QWidget::mapFromAndTo() QCOMPARE(window.mapToGlobal(QPoint(-10, 0)), QPoint(90, 100)); QCOMPARE(window.mapToGlobal(QPoint(0, -10)), QPoint(100, 90)); QCOMPARE(window.mapToGlobal(QPoint(100, 100)), QPoint(200, 200)); + auto delta = window.mapToGlobal(QPointF(100.5, 100.5)) - QPointF(200.5, 200.5); + QVERIFY(qFuzzyIsNull(delta.manhattanLength())); QCOMPARE(window.mapToGlobal(QPoint(110, 100)), QPoint(210, 200)); QCOMPARE(window.mapToGlobal(QPoint(100, 110)), QPoint(200, 210)); QCOMPARE(window.mapFromGlobal(QPoint(100, 100)), QPoint(0, 0)); @@ -1616,6 +1618,8 @@ void tst_QWidget::mapFromAndTo() QCOMPARE(window.mapFromGlobal(QPoint(90, 100)), QPoint(-10, 0)); QCOMPARE(window.mapFromGlobal(QPoint(100, 90)), QPoint(0, -10)); QCOMPARE(window.mapFromGlobal(QPoint(200, 200)), QPoint(100, 100)); + delta = window.mapFromGlobal(QPointF(200.5, 200.5)) - QPointF(100.5, 100.5); + QVERIFY(qFuzzyIsNull(delta.manhattanLength())); QCOMPARE(window.mapFromGlobal(QPoint(210, 200)), QPoint(110, 100)); QCOMPARE(window.mapFromGlobal(QPoint(200, 210)), QPoint(100, 110)); QCOMPARE(window.mapToParent(QPoint(0, 0)), QPoint(100, 100)); -- cgit v1.2.3