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 create QPixMaps, or because your existing subsystem uses QPixMaps for everything, or any other valid reason, then it is not possible to create Hi DPI QIcons.

    When attempting to create QIcon from QPixMap, you'd expect to be able to do this:

    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:
    0_1557863382934_Screen Shot 2019-05-14 at 12.47.24 PM.png

    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.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.