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>
This commit is contained in:
Morten Johan Sørvig 2013-10-28 16:45:40 +01:00 committed by The Qt Project
parent 542e266f88
commit 762c3d87de

View File

@ -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();
}