[Interest] Optimizing QGraphicsView

Till Oliver Knoll till.oliver.knoll at gmail.com
Tue Dec 17 08:55:57 CET 2013


Am 17.12.2013 um 07:36 schrieb Brad Pepers <bpepers at me.com>:

> ...
> 
> Would it be better to render the SVG into pixmaps and just add them as QGraphicsPixmapItems that also don't transform?

Definitively that! Drawing a pixmap is far simpler than evaluating a SVG model (even if Qt would cache the result of the SVG parsing somewhere) and painting dots and lines, filling polygons etc. for each "frame" (view update).

Especially since you say you don't want to scale the items anyway, drawing them into pixmaps first would go without loss of visual quality. Au contraire, you could apply all fancy anti-aliasing, post-processing (e.g. sharpening and what not) once on the pixmaps without worrying about performance later.

And if you still want to scale the items later on - or support "high resolution displays" - you could come up with your own QGraphicsPixmapItem based class which would store multiple resolutions of the pixmap, and maybe even interpolate between those resolutions (super fancy! ;)) while zooming.

Cheers,
  Oliver


More information about the Interest mailing list