diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-05-21 13:52:53 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@digia.com> | 2015-03-26 11:00:14 +0100 |
commit | 70f565b6e43b6ab93b01112286a40869155207c8 (patch) | |
tree | ed4c7fee3fdc5a25bce1041e9aa4616155b8eabd /src/gui/kernel/qguiapplication.cpp | |
parent | 3cede847c39269374c52dcf156dc982d7a51f29c (diff) |
WIP: Add platform independent high-dpi support to QtGui
Add coordinate scaling support to the QWindow/
QWindowSystemInterface layer. The scale factor can
be set with the QT_HIGHDPI_SCALE_FACTOR environment
variable.
Setting a scale factor different than the default (1)
now has the following effects:
QWindow::devicePixelRatio is set accordingly, enabling
the high-dpi code paths.
QWindow and related classes now return geometry in
device independent pixels. This includes screen,
desktop and window geometry as well as event coordinates.
The platform plugins continue to operate in device
pixels, unaware of the scaling.
Task-number: QTBUG-38858
Change-Id: I85b0d1bc682b25196f6db286e672a64f8da0ae5c
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 3d21b4affc..7b8d5f823e 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -957,9 +957,10 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos) QList<QScreen *>::const_iterator screen = screens.constBegin(); QList<QScreen *>::const_iterator end = screens.constEnd(); + const QPoint devicePosition = qHighDpiToDevicePixels(pos); while (screen != end) { if ((*screen)->geometry().contains(pos)) - return (*screen)->handle()->topLevelAt(pos); + return (*screen)->handle()->topLevelAt(devicePosition); ++screen; } return 0; |