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>
This commit is contained in:
David Faure 2019-09-07 23:14:19 +02:00
parent c6bde29e14
commit 00d0a53035

View File

@ -680,8 +680,11 @@ QDpi QHighDpiScaling::logicalDpi(const QScreen *screen)
if (!screen || !screen->handle()) if (!screen || !screen->handle())
return QDpi(96, 96); return QDpi(96, 96);
if (!m_usePixelDensity) if (!m_usePixelDensity) {
return QPlatformScreen::overrideDpi(screen->handle()->logicalDpi()); 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 scaleFactor = rawScaleFactor(screen->handle());
const qreal roundedScaleFactor = roundScaleFactor(scaleFactor); const qreal roundedScaleFactor = roundScaleFactor(scaleFactor);