Qt IconEngine: Use a device pixel ratio of 1 when high-DPI pixmaps are disabled - #32221
Conversation
|
I suspect we are using devicePixelRatio() also for other sizes like canvas/window size and event locations. Would those aspects not break when changing the behavior of devicePixelRatio()? |
This only modifies dpr = self._devicePixelRatio()
scaled_size = QtCore.QSize(int(size.width() * dpr), int(size.height() * dpr))
pixmap = QtGui.QPixmap(scaled_size)
pixmap.setDevicePixelRatio(dpr)On my retina display, I'm seeing the canvas and window at the correct size and events seem to still report the correct x/y coordinates. That said:
|
|
Ok thanks for the clarification. Reviewing from the phone is not optimal as it’s harder to see all context. |
|
The result is more complicated on Linux. If I run with This PR fixes the toolbar icons in the latter case. It does not fix the inconsistency between platform libraries, which I think must have to do with the other global |
QuLogic
left a comment
There was a problem hiding this comment.
There is possibly more to do, noted above, but this does fix the original issue.
… high-DPI pixmaps are disabled
…221-on-v3.11.x Backport PR #32221 on branch v3.11.x (Qt IconEngine: Use a device pixel ratio of 1 when high-DPI pixmaps are disabled)
PR summary
On Qt5, if the
QApplicationinstance has anAA_UseHighDpiPixmapsattribute set to false, our_IconEnginewill return icons that are too large.Check this attribute and return
1for_IconEngine._devicePixelRatio()if high DPI pixmaps are disabled.This attribute is always true on Qt6.
Closes #32217
AI Disclosure
I used AI to help me write a test reduction for #32217. I used AI to help me clean up the resulting implementation.
PR quality check