Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.15.2, 6.1.2, 6.2.0 Beta3
-
None
-
Broken: Arch Linux, KDE X11, Qt 6.1.2 from Arch, and Qt 6.2.0 beta3 from web installer
Working: Windows 10 x64, Qt 6.2.0 beta3 from web installer
-
-
1c0a56a2f3 (qt/qtbase/dev) 1c0a56a2f3 (qt/tqtc-qtbase/dev) be3f589d17 (qt/qtbase/6.4) be3f589d17 (qt/tqtc-qtbase/6.4), 9a39b3c79 (dev)
Description
On Linux (Arch Linux KDE X11 with global fractional scaling enabled), calling QGuiApplication::setHighDpiScaleFactorRoundingPolicy() with a rounding mode fails to change the actual DPI rounding policy. QImage/QPixmap is still painted with non-uniform pixel sizes, and QWidget::devicePixelRatio() is still a non-integer. Fetching the policy using QGuiApplication::highDpiScaleFactorRoundingPolicy() still returns the rounding mode you set, but it doesn't change the app's behavior.
On Windows, this function works as expected.
Test app at https://github.com/nyanpasu64/qt6-dpi-fail/tree/device-pixel-ratio (note, not master branch). It calls QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor) and clicking the button prints the current rounding policy and devicePixelRatio. On Windows it's "RoundPreferFloor -> 1", and on Linux it's "RoundPreferFloor -> 1.25".
EDIT: This issue occurs on any environment where the scale factor is set through QScreen's "_q_scaleFactor" property or the QT_SCREEN_SCALE_FACTORS environment variable, and not on environments where the platform plugin supplies the scale factor.
Attachments
Issue Links
- relates to
-
QTBUG-99546 QT_SCREEN_SCALE_FACTORS doesn't follow rounding policy
- Closed