diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 55bed86080..6a47e31d91 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -12752,9 +12752,8 @@ int QWidget::metric(PaintDeviceMetric m) const // Note: keep in sync with QBackingStorePrivate::backingStoreDevicePixelRatio()! static bool downscale = qEnvironmentVariableIntValue("QT_WIDGETS_HIGHDPI_DOWNSCALE") > 0; QWindow *window = this->window()->windowHandle(); - if (downscale && window) - return std::ceil(window->devicePixelRatio()); - + if (window) + return downscale ? std::ceil(window->devicePixelRatio()) : window->devicePixelRatio(); return screen->devicePixelRatio(); };