Update QHighDpiScaling on DPI change

Make sure Qt reacts correctly to DPI changes while the
application is running, also when going from “standard-dpi”
to “high-dpi” (like Windows 100% to 200%).

Call QHighDpiScaling::upateHighDpiScaling() on DPI
change and update the m_usePixelDensity flag from there.

Fixes: QTBUG-85384
Pick-to: 5.15
Change-Id: I8ca83e4eea76cc8ba701a18e1f8c535b9953918f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Morten Johan Sørvig 2020-08-07 11:36:31 +02:00
parent ade59ea316
commit 733b653844
2 changed files with 4 additions and 0 deletions

View File

@ -3092,6 +3092,8 @@ void QGuiApplicationPrivate::processScreenLogicalDotsPerInchChange(QWindowSystem
if (QCoreApplication::startingUp())
return;
QHighDpiScaling::updateHighDpiScaling();
if (!e->screen)
return;

View File

@ -495,6 +495,8 @@ void QHighDpiScaling::updateHighDpiScaling()
if (QCoreApplication::testAttribute(Qt::AA_DisableHighDpiScaling))
return;
m_usePixelDensity = usePixelDensity();
if (m_usePixelDensity && !m_pixelDensityScalingActive) {
const auto screens = QGuiApplication::screens();
for (QScreen *screen : screens) {