path: root/src/plugins/platforms/windows/qwindowsscreen.cpp
diff options
authorJocelyn Turcotte <>2017-01-17 17:05:00 +0100
committerJocelyn Turcotte (Woboq GmbH) <>2017-01-23 18:42:26 +0000
commitdd52fd0024600d3beffc82d6da02b4239a62d725 (patch)
tree42dd52f4aa23179601792b1794f7b8ec3c1d1971 /src/plugins/platforms/windows/qwindowsscreen.cpp
parentaa8fb3608952ab9f344e2b6beb7e083908c8d905 (diff)
Ensure a pixel density of at least 1 for Qt::AA_EnableHighDpiScaling
Very large 1080p TVs or any display which is running at an abnormally low resolution can have a DPI lower than 48, which means that qRound(dpi/96) will result in a 0 pixel density, causing critical issues for applications using Qt::AA_EnableHighDpiScaling. Make sure that we always have a pixel density of at least 1 to allow applications not having to worry about such displays. Task-number: QTBUG-56140 Change-Id: I1dafbf7794a99ae6f872984c0337d8ff0d1fc1c0 Reviewed-by: Shawn Rutledge <> Reviewed-by: Friedemann Kleint <>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsscreen.cpp')
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index 7a885b462e..c70323c06f 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -265,7 +265,7 @@ qreal QWindowsScreen::pixelDensity() const
// the pixel density since it is reflects the Windows UI scaling.
// High DPI auto scaling should be disabled when the user chooses
// small fonts on a High DPI monitor, resulting in lower logical DPI.
- return qRound(logicalDpi().first / 96);
+ return qMax(1, qRound(logicalDpi().first / 96));