summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2019-09-07 23:14:19 +0200
committerDavid Faure <david.faure@kdab.com>2019-09-13 15:36:11 +0200
commit00d0a530358d40d577578cb1bcb75a978549bd8d (patch)
tree052508ad618ddaf2ec36d7ffc41c50017dd5da11
parentc6bde29e143b1fadac97f656ba6c3059135d4a11 (diff)
QDpi: divide the forced DPI by the scaling factor, as Qt 5.13 did
When setting a DPI in xrdb, it should have the same effect on apps that enable scaling and apps that don't (including Qt4 and GTK applications). That's what happened in Qt 5.13, while the recent changes removed that division, and as a result the fonts were huge in Qt5 apps compared to Qt4/GTK/kwin/plasmashell/krunner (which don't scale, but do honor the font DPI). Change-Id: Icd7be2d15a9b50982ae624e41bd9e546f315d58b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
index dcbae4f5c0..ee54fd4fa1 100644
--- a/src/gui/kernel/qhighdpiscaling.cpp
+++ b/src/gui/kernel/qhighdpiscaling.cpp
@@ -680,8 +680,11 @@ QDpi QHighDpiScaling::logicalDpi(const QScreen *screen)
if (!screen || !screen->handle())
return QDpi(96, 96);
- if (!m_usePixelDensity)
- return QPlatformScreen::overrideDpi(screen->handle()->logicalDpi());
+ if (!m_usePixelDensity) {
+ const qreal screenScaleFactor = screenSubfactor(screen->handle());
+ const QDpi dpi = QPlatformScreen::overrideDpi(screen->handle()->logicalDpi());
+ return QDpi{ dpi.first / screenScaleFactor, dpi.second / screenScaleFactor };
+ }
const qreal scaleFactor = rawScaleFactor(screen->handle());
const qreal roundedScaleFactor = roundScaleFactor(scaleFactor);