Skip to content

Commit

Permalink
QDpi: divide the forced DPI by the scaling factor, as Qt 5.13 did
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Morten Johan Sørvig <[email protected]>
  • Loading branch information
dfaure-kdab committed Sep 13, 2019
1 parent c6bde29 commit 00d0a53
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/gui/kernel/qhighdpiscaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 00d0a53

Please sign in to comment.