[Interest] High-dpi fixing for Qt 5.5

Sorvig Morten Morten.Sorvig at theqtcompany.com
Wed Mar 25 14:01:09 CET 2015


> On 24 Mar 2015, at 17:01, Till Oliver Knoll <till.oliver.knoll at gmail.com> wrote:
> 
> But since the QGraphicsPixmapItem is doing the drawing for me, I probably really need to get informed about resolution changes, and replace the pixmaps in the QGraphicsViewItem myself as needed (unless I am overseeing some other, simpler solution here). Or maybe if I would overwrite the QGraphicsPixmapItem::paint() method and use something like the above code... but that would almost defy the reason why I would use a QGraphicsPixmapItem in the first place... (I could derive from QGraphicsItem then directly instead).

This may be an accurate observation on the usefulness of QGraphicsPixmapItem when targeting multiple pixel densities. 

To me QGraphicsPixmapItem::paint() looks like the right place to generate a new pixmap on demand - you should be able to check if painter->device()->devicePixelRatio() has changed since the previous draw call.

Morten




More information about the Interest mailing list