diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-06-11 09:24:12 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-07-14 10:25:47 +0200 |
| commit | 37d5aaa4b42f9c837f0d27edb9da2185971d02be (patch) | |
| tree | 867c23bfbff55f3d27dfee553ab20b015a938aa0 /src/gui/kernel/qplatformwindow.cpp | |
| parent | 80f7494e8a9f9a70e3b53833a098d74d8c2331d9 (diff) | |
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 <shawn.rutledge@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui/kernel/qplatformwindow.cpp')
| -rw-r--r-- | src/gui/kernel/qplatformwindow.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index c6e6afcc91f..4b7d7f5b7eb 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -266,6 +266,20 @@ QPoint QPlatformWindow::mapToGlobal(const QPoint &pos) const return result; } +QPointF QPlatformWindow::mapToGlobalF(const QPointF &pos) const +{ + const QPoint posPt = pos.toPoint(); + const QPointF delta = pos - posPt; + return mapToGlobal(posPt) + delta; +} + +QPointF QPlatformWindow::mapFromGlobalF(const QPointF &pos) const +{ + const QPoint posPt = pos.toPoint(); + const QPointF delta = pos - posPt; + return mapFromGlobal(posPt) + delta; +} + /*! Translates the global screen coordinate \a pos to window coordinates using native methods. This is required for embedded windows, |
