diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2013-10-28 16:45:40 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-06 14:21:56 +0100 |
commit | 762c3d87de67ec8e8df8b810065ca5fe86db87a9 (patch) | |
tree | 94ea4fcc50164d1e24b6532fe9bc38dddde6cbeb /src/gui | |
parent | 542e266f8806517e2a4151a79570cb8f5ade0ef2 (diff) |
Don't hardcode devicePixelRatio to 1.
This code path can and will be hit during app startup,
and can result in low-resolution images being used
on high-dpi systems.
Use qApp->devicePixelRatio() instead, which is more
likely to be correct.
Change-Id: Ic881cfedd8e962037d2d4af4a1242f590d56c194
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index e0e1638d75..a6223987c2 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -986,8 +986,13 @@ Qt::ScreenOrientation QWindow::contentOrientation() const qreal QWindow::devicePixelRatio() const { Q_D(const QWindow); + + // If there is no platform window, do the second best thing and + // return the app global devicePixelRatio. This is the highest + // devicePixelRatio found on the system screens, and will be + // correct for single-display systems (a very common case). if (!d->platformWindow) - return 1.0; + return qApp->devicePixelRatio(); return d->platformWindow->devicePixelRatio(); } |