diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2015-06-02 11:53:14 +0300 |
---|---|---|
committer | Alexander Volkov <a.volkov@rusbitech.ru> | 2015-06-19 10:49:49 +0000 |
commit | 36df3305f9fc7847710dd8ab0e4ea5c4e3252bce (patch) | |
tree | 4c224b78739c3616db72fa237dcb8193953337d8 /src/plugins/platforms/xcb/qxcbscreen.cpp | |
parent | de811595744d49a8cd82d7823ba766f96b71287d (diff) |
xcb: Map touch points to screen coordinates
Add QPointF overloads for QXcbScreen::mapToNative() and
QXcbScreen::mapFromNative(). Use mapFromNative() to map
the coordinates of a touch point to screen coordinates
as we do it for mouse events. It fixes touch events when
QT_DEVICE_PIXEL_RATIO is set.
Change-Id: Id8362cda526e0f837b76899eba21d9bfc895988c
Task-number: QTBUG-44840
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbscreen.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbscreen.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index c14ec0bb3f..993566b11c 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -282,6 +282,18 @@ QPoint QXcbScreen::mapFromNative(const QPoint &pos) const return (pos - m_nativeGeometry.topLeft()) / dpr + m_geometry.topLeft(); } +QPointF QXcbScreen::mapToNative(const QPointF &pos) const +{ + const int dpr = int(devicePixelRatio()); + return (pos - m_geometry.topLeft()) * dpr + m_nativeGeometry.topLeft(); +} + +QPointF QXcbScreen::mapFromNative(const QPointF &pos) const +{ + const int dpr = int(devicePixelRatio()); + return (pos - m_nativeGeometry.topLeft()) / dpr + m_geometry.topLeft(); +} + QRect QXcbScreen::mapToNative(const QRect &rect) const { const int dpr = int(devicePixelRatio()); |