summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Edmundson <davidedmundson@kde.org>2022-11-30 11:31:10 +0000
committerDavid Edmundson <davidedmundson@kde.org>2022-12-08 14:35:18 +0000
commit687a206b2e3404b30ba24130294a92ea55a83dde (patch)
treeb8d1e0d5f0defbdcd95f50badf40d38254395769
parentcbd5bc0b587de74d900494817509717ef2f0c472 (diff)
QWidget: use window device pixel ratio for metrics
Most code uses the window/backing store DPR, except for this path that uses the screen. On wayland it's possible to get a different ratio for the screen and window which causes some subtle rendering issues. For other platforms behavior shouldn't change. Change-Id: Ie390ba3bdfc183815df9e7e79e508d3e15d61f25 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
-rw-r--r--src/widgets/kernel/qwidget.cpp5
1 files changed, 2 insertions, 3 deletions
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();
};