summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2020-09-30 15:26:59 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-10-05 08:57:54 +0000
commit9103d82d0196ba12263329af7dc37eb056700ece (patch)
tree0c110418da0b398da0377f046b20af5092d06497 /src/gui
parent54232d6ea98a313390ee8f36bbadadce49ff97f3 (diff)
Make the logicalDpi() default implementation return 96
Remove the code which calculates physical DPI and call logicalBaseDpi() instead. This will make sure that Qt gets a device pixel ratio of 1.0 by default, for the cases where the platform plugin does not implement logicalDpi() itself. Task-number: QTBUG-87035 Change-Id: I08433c9465be03d27b3decccb0e2e7e5e6aff0ae Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qplatformscreen.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp
index a89d4d007b..0920f46975 100644
--- a/src/gui/kernel/qplatformscreen.cpp
+++ b/src/gui/kernel/qplatformscreen.cpp
@@ -174,21 +174,16 @@ QSizeF QPlatformScreen::physicalSize() const
Reimplement this function in subclass to return the logical horizontal
and vertical dots per inch metrics of the screen.
- The logical dots per inch metrics are used by QFont to convert point sizes
- to pixel sizes.
+ The logical dots per inch metrics are used by Qt to scale the user interface.
- The default implementation uses the screen pixel size and physical size to
- compute the metrics.
+ The default implementation returns logicalBaseDpi(), which results in a
+ UI scale factor of 1.0.
\sa physicalSize
*/
QDpi QPlatformScreen::logicalDpi() const
{
- QSizeF ps = physicalSize();
- QSize s = geometry().size();
-
- return QDpi(25.4 * s.width() / ps.width(),
- 25.4 * s.height() / ps.height());
+ return logicalBaseDpi();
}
// Helper function for accessing the platform screen logical dpi
@@ -205,7 +200,7 @@ QPair<qreal, qreal> QPlatformScreen::overrideDpi(const QPair<qreal, qreal> &in)
default implementation returns 96.
QtGui will use this value (together with logicalDpi) to compute
- the scale factor when high-DPI scaling is enabled:
+ the scale factor when high-DPI scaling is enabled, as follows:
factor = logicalDPI / baseDPI
*/
QDpi QPlatformScreen::logicalBaseDpi() const