summaryrefslogtreecommitdiff
path: root/src/widgets/styles
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2020-02-20 11:25:49 +0100
committerMorten Johan Sørvig <morten.sorvig@qt.io>2020-02-21 10:38:58 +0100
commit4e1c41a26eaa51ebb133e9c846e8e93bbe318a2e (patch)
treea858ed1a74c636360bcbc7b12cb67e47e3a9d170 /src/widgets/styles
parentfb6acf08bbd7a68d027282251747620b942bd1d6 (diff)
downloadqtbase-4e1c41a26eaa51ebb133e9c846e8e93bbe318a2e.tar.gz
QStyle: Use primary screen DPI as default DPI
Change d603ee68 made the default DPI be 96, for cases where a style option is not provided. This causes inconsistencies, since there are in fact several cases where QStyle API is called without a style option. Restore historical Qt behavior of using the primary screen DPI. Single-screen systems should now be consistent, as before. Task-number: QTBUG-82356 Change-Id: I849934ca2e5604b9fb2f045ed4f6058f3e0426ff Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/qstylehelper.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index 9477ca86da..6016224faa 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -101,7 +101,13 @@ Q_WIDGETS_EXPORT qreal dpi(const QStyleOption *option)
if (option)
return option->fontMetrics.fontDpi();
+ // Fall back to historical Qt behavior: hardocded 72 DPI on mac,
+ // primary screen DPI on other platforms.
+#ifdef Q_OS_DARWIN
return qstyleBaseDpi;
+#else
+ return qt_defaultDpiX();
+#endif
}
Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, qreal dpi)