Priority: P2: Important
Affects Version/s: 5.15.2, 6.1.2, 6.2.0 Beta3
Fix Version/s: None
Component/s: GUI: High-DPI
Environment: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
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.
|For Gerrit Dashboard: QTBUG-95930|
|412296,3||Apply ScaleFactorRoundingPolicy to QT_SCREEN_SCALE_FACTORS||dev||qt/qtbase||Status: NEW||+1||0|