summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformscreen.cpp
diff options
context:
space:
mode:
authorThe Qt Project <gerrit-noreply@qt-project.org>2019-10-14 08:49:14 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2019-10-14 08:49:14 +0000
commiteba59bfd14d0ea29f36e80be81137d26cc67e23a (patch)
tree69ff8601b3d4a62bea38e1a32245f45cb744aaac /src/gui/kernel/qplatformscreen.cpp
parentf03ac58b1ecc24f01cb83b275a9b6088f9483545 (diff)
parentf4b4c4f79b629498f3cddbbc10df8c1b4d6020d9 (diff)
Merge "Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake" into wip/cmake
Diffstat (limited to 'src/gui/kernel/qplatformscreen.cpp')
-rw-r--r--src/gui/kernel/qplatformscreen.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp
index 9c5876550a..f3213bf5ea 100644
--- a/src/gui/kernel/qplatformscreen.cpp
+++ b/src/gui/kernel/qplatformscreen.cpp
@@ -193,6 +193,28 @@ QDpi QPlatformScreen::logicalDpi() const
25.4 * s.height() / ps.height());
}
+// Helper function for accessing the platform screen logical dpi
+// which accounts for QT_FONT_DPI.
+QPair<qreal, qreal> QPlatformScreen::overrideDpi(const QPair<qreal, qreal> &in)
+{
+ static const int overrideDpi = qEnvironmentVariableIntValue("QT_FONT_DPI");
+ return overrideDpi > 0 ? QDpi(overrideDpi, overrideDpi) : in;
+}
+
+/*!
+ Reimplement to return the base logical DPI for the platform. This
+ DPI value should correspond to a standard-DPI (1x) display. The
+ default implementation returns 96.
+
+ QtGui will use this value (together with logicalDpi) to compute
+ the scale factor when high-DPI scaling is enabled:
+ factor = logicalDPI / baseDPI
+*/
+QDpi QPlatformScreen::logicalBaseDpi() const
+{
+ return QDpi(96, 96);
+}
+
/*!
Reimplement this function in subclass to return the device pixel ratio
for the screen. This is the ratio between physical pixels and the