From 762c3d87de67ec8e8df8b810065ca5fe86db87a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 28 Oct 2013 16:45:40 +0100 Subject: [PATCH] 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 Reviewed-by: Jens Bache-Wiig --- src/gui/kernel/qwindow.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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(); }