[PyQt] QGraphisView performance
Giovanni Bajo
rasky at develer.com
Mon Nov 24 16:35:53 GMT 2008
On 11/22/2008 6:35 AM, Nahuel Defossé wrote:
> Hi,
> I'm trying to display a map on a QGraphicsView widget having some scrolling
> and zooming. I need very basic interaction, add points, remove points, maybe
> a contextual menu. The issue I'm experiencing is that zooming and scrolling
> when on high zoom values is SLOW.
> For zooming I use view.setMatrix(QtGui.QMatrix().scale(factor, factor)) where
> factor > 1)
> At first I tried to show directly the map I converted from a DFX file, a big
> SVG, using QtSvg.QGraphicsSvgItem but it was big and I knew it was gonna take
> a lot of CPU, it did. Then I tried with a pixmap, PNG 150k, which works
> better when no zoom is applied but starts to sorely degrade as the zoom
> factor raises.
> I don't understand which is the best approach to achieve acceptable
> performance when you have to show big areas on this kind of canvas.
> I'd highly appreciate any hints
My understanding is that QGraphicsView is just slow for this kind of
thing (displaying a zoomed big picture). I also understand that this has
been fixed in Qt 4.5, but I am not hundred percent sure.
You could try changing the graphics backend of QGraphicsView from the
default one (raster or native) to the OpenGL one. I think this can be
achieved by manually setting a QGLWidget as viewport, or something like
that. Again, in Qt 4.5 this is just a matter of passing "-graphicssystem
opengl" on the command line, which makes it easier to play with.
--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com
More information about the PyQt
mailing list