Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
5.12.1, 5.13.0 Alpha 1
-
None
-
Windows 10 with a 4k and 1080p screen
-
-
81a790969395feff73fa600908822765e97424e5 (qt/qtbase/5.15)
Description
QPushbutton with an icon behaves incorrectly in a mixed-dpi environment. In particular,
QFusionStyle::drawControl draws the icon for CE_PushButtonLabel like:
QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state);
but QCommonStyle::drawControl does it like:
QPixmap pixmap = button->icon.pixmap(qt_getWindow(widget), button->iconSize, mode, state);
Because Fusion style is missing the QWindow* parameter to QIcon.pixmap() call, the global qApp->devicePixelRatio is always being applied, even on widgets / screens where this is not appropriate. In my case, the QIcon draws correctly on a 4k screen but not on a secondary 1080p screen.
I have attached 2 screenshots that demonstrate the issue. I created a QIcon with pixmaps of both 90x90 and 30x30. With style Fusion, QIcon:pixmap selects the 90x90 icon (which is not correct, and it's rendered jagged). Without fusion style, the correct 30x30 pixmap is chosen.
Attachments
For Gerrit Dashboard: QTBUG-74100 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
276261,4 | Fusion Style: Use high-dpi pixmaps | 5.14 | qt/qtbase | Status: MERGED | +2 | 0 |