QIcon Hi DPI (retina) from QPixMap
-
The
QIcon
doc suggests using files to create Hi DPI icons. but if that's not possible, because you programmatically createQPixMap
s, or because your existing subsystem usesQPixMap
s for everything, or any other valid reason, then it is not possible to create Hi DPI QIcons.When attempting to create
QIcon
fromQPixMap
, you'd expect to be able to do this:qPix->setDevicePixelRatio(devicePixelRatio()); QIcon icon(qPix); // <-- we should be good to go now, right?
and have the scale setting (why is it called PixelRatio?) to be preserved in the icon, but it is not. :(
is there some magic invocation i can do to get this to work with QPixMaps (not files, and not themes) ?
see how all icons come out low-dpi:
This bug was previously reported here, but then ignored because... the maintainer thought the report was ... "too convoluted to be useful" (?) It seems quite straight forward to me, IMHO :)
-
-
please: if you would also like to see this bug in Qt fixed, please click the bug and upvote it. thanks.