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 --- src/widgets/kernel/qapplication.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/widgets/kernel/qapplication.cpp') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index f19801f511..951fc9cd67 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3207,7 +3207,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } if (w->isWindow()) break; - dragEvent->p = w->mapToParent(dragEvent->p.toPoint()); + dragEvent->p = w->mapToParent(dragEvent->p); w = w->parentWidget(); } } @@ -3232,7 +3232,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) QDropEvent *dragEvent = static_cast(e); QWidget *origReciver = static_cast(receiver); while (origReciver && w != origReciver) { - dragEvent->p = origReciver->mapToParent(dragEvent->p.toPoint()); + dragEvent->p = origReciver->mapToParent(dragEvent->p); origReciver = origReciver->parentWidget(); } } @@ -3942,11 +3942,8 @@ bool QApplicationPrivate::updateTouchPointsForWidget(QWidget *widget, QTouchEven bool containsPress = false; for (QEventPoint &pt : QMutableTouchEvent::from(touchEvent)->touchPoints()) { - // preserve the sub-pixel resolution const QPointF screenPos = pt.globalPosition(); - const QPointF delta = screenPos - screenPos.toPoint(); - - QMutableEventPoint::from(pt).setPosition(widget->mapFromGlobal(screenPos.toPoint()) + delta); + QMutableEventPoint::from(pt).setPosition(widget->mapFromGlobal(screenPos)); if (pt.state() == QEventPoint::State::Pressed) containsPress = true; -- cgit v1.2.3