Rendering errors at 125% DPI scaling
At 125% DPI scaling, the toolbar icons look pixelated and the canvas has rendering glitches when selecting and dragging objects around. I actually run KDE Plasma X11 at 100% DPI scaling (QT_SCREEN_SCALE_FACTORS=VGA-0=1;DVI-D-0=1;HDMI-0=1;
) with X11 DPI set to 120 (125% font scaling), but it seems Qt 6 interprets this as 125% QPainter scaling instead.
Adding QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor);
before constructing a QApplication
instance seems to prevent this from happening on my setup (100% screen scaling, 125% font scaling) by making Qt 6 not treat font scaling as QPainter scaling. But if I change my setup to 125% screen scaling, the bugs come back even with setHighDpiScaleFactorRoundingPolicy
set (because the QT_SCREEN_SCALE_FACTORS
environment variable set by KDE overrides setHighDpiScaleFactorRoundingPolicy
). So this will still break on some users' computers.
Personally I don't like fractional QPainter scaling since one virtual pixel is no longer an integer number of physical pixels, and see the bugfixes to make KDE's programs work with it as unprincipled hacks. But since fractional QPainter scaling is rather common among KDE users, you might have to find a way to make your program work with it anyway. (Personally I chose not to support it in apps I contribute to, since I no longer use fractional display scaling on my own computer and consider it a hack.)