summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r--src/gui/kernel/qwindow.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index d84035e29c..4465a9aeb4 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1086,17 +1086,13 @@ qreal QWindow::devicePixelRatio() const
{
Q_D(const QWindow);
- // Get the platform scale factor. If there is no platform window
- // use the app global devicePixelRatio, which is the the highest
- // devicePixelRatio found on the system screens, and will be
- // correct for single-display systems (a very common case).
- qreal ratio = d->platformWindow ? d->platformWindow->devicePixelRatio()
- : qApp->devicePixelRatio();
-
- //
- ratio *= QHighDpiScaling::factor(this);
+ // If there is no platform window use the app global devicePixelRatio,
+ // which is the the highest devicePixelRatio found on the system
+ // screens, and will be correct for single-display systems (a very common case).
+ if (!d->platformWindow)
+ return qApp->devicePixelRatio();
- return ratio;
+ return d->platformWindow->devicePixelRatio() * QHighDpiScaling::factor(this);
}
/*!