88 lines
3.4 KiB
Diff
88 lines
3.4 KiB
Diff
From 65243ad7aef48af4689ea4454916b504025b5051 Mon Sep 17 00:00:00 2001
|
|
From: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
Date: Fri, 25 Sep 2020 14:10:58 +0200
|
|
Subject: Emit QScreen::geometryChanged when the logical DPI changes
|
|
|
|
Add the missing call to QScreenPrivate::emitGeometryChangeSignals()
|
|
along with an emission of physicalDotsPerInchChanged()
|
|
since that is calculated from geometry and physical size.
|
|
|
|
Rearrange the code in
|
|
QGuiApplicationPrivate::processScreenGeometryChange()
|
|
to prevent duplicate emissions of geometryChanged(),
|
|
physicalDotsPerInchChanged() which this change would introduce.
|
|
|
|
Amends 5290027e3bab75f14fc0a2b7c206594d9cb91e76.
|
|
|
|
Task-number: QTBUG-76902
|
|
Task-number: QTBUG-79248
|
|
Fixes: QTBUG-86604
|
|
Change-Id: I3dc2ec5ccd9c6413e92f9246242f323e8afc5e57
|
|
Reviewed-by: David Edmundson <davidedmundson@kde.org>
|
|
(cherry picked from commit 5c7307775d32ae0a54acad8ae7a1c9d3cff7d45e)
|
|
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
---
|
|
src/gui/kernel/qguiapplication.cpp | 11 +++++------
|
|
src/gui/kernel/qscreen.cpp | 6 ++++++
|
|
2 files changed, 11 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
|
|
index 239a78313c..ef09060581 100644
|
|
--- qtbase/src/gui/kernel/qguiapplication.cpp
|
|
+++ qtbase/src/gui/kernel/qguiapplication.cpp
|
|
@@ -3162,13 +3162,14 @@ void QGuiApplicationPrivate::processScreenGeometryChange(QWindowSystemInterfaceP
|
|
bool availableGeometryChanged = e->availableGeometry != s->d_func()->availableGeometry;
|
|
s->d_func()->availableGeometry = e->availableGeometry;
|
|
|
|
- if (geometryChanged) {
|
|
- Qt::ScreenOrientation primaryOrientation = s->primaryOrientation();
|
|
+ const Qt::ScreenOrientation primaryOrientation = s->primaryOrientation();
|
|
+ if (geometryChanged)
|
|
s->d_func()->updatePrimaryOrientation();
|
|
|
|
- emit s->geometryChanged(s->geometry());
|
|
+ s->d_func()->emitGeometryChangeSignals(geometryChanged, availableGeometryChanged);
|
|
+
|
|
+ if (geometryChanged) {
|
|
emit s->physicalSizeChanged(s->physicalSize());
|
|
- emit s->physicalDotsPerInchChanged(s->physicalDotsPerInch());
|
|
emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch());
|
|
|
|
if (s->primaryOrientation() != primaryOrientation)
|
|
@@ -3178,8 +3179,6 @@ void QGuiApplicationPrivate::processScreenGeometryChange(QWindowSystemInterfaceP
|
|
updateFilteredScreenOrientation(s);
|
|
}
|
|
|
|
- s->d_func()->emitGeometryChangeSignals(geometryChanged, availableGeometryChanged);
|
|
-
|
|
resetCachedDevicePixelRatio();
|
|
}
|
|
|
|
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
|
|
index df628fcc73..a1afc1ba14 100644
|
|
--- qtbase/src/gui/kernel/qscreen.cpp
|
|
+++ qtbase/src/gui/kernel/qscreen.cpp
|
|
@@ -88,6 +88,9 @@ void QScreenPrivate::updateGeometriesWithSignals()
|
|
void QScreenPrivate::emitGeometryChangeSignals(bool geometryChanged, bool availableGeometryChanged)
|
|
{
|
|
Q_Q(QScreen);
|
|
+ if (geometryChanged)
|
|
+ emit q->geometryChanged(geometry);
|
|
+
|
|
if (availableGeometryChanged)
|
|
emit q->availableGeometryChanged(availableGeometry);
|
|
|
|
@@ -96,6 +99,9 @@ void QScreenPrivate::emitGeometryChangeSignals(bool geometryChanged, bool availa
|
|
for (QScreen* sibling : siblings)
|
|
emit sibling->virtualGeometryChanged(sibling->virtualGeometry());
|
|
}
|
|
+
|
|
+ if (geometryChanged)
|
|
+ emit q->physicalDotsPerInchChanged(q->physicalDotsPerInch());
|
|
}
|
|
|
|
void QScreenPrivate::setPlatformScreen(QPlatformScreen *screen)
|
|
--
|
|
cgit v1.2.1
|
|
|