[Qgis-developer] Potential performance improvements by using Qt's Graphics View Framework

Jae Sammy jcs at rincon.com
Mon Apr 5 13:55:39 EDT 2010


After trying to optimize my project that loads layers that fall into three categories:
 * A large number of static rasters (as a background)
 * A small number of PostGIS layers that change frequently (once every couple of seconds)
 * A large number of PostGIS layers that change infrequently (once every couple of minutes)
I seem to have hit a brick wall.

It appears that QGis boils all of the loaded layers down to a single QGraphicsRectItem (QgsMapCanvasMap).  This means that in my case, I must trigger a repaint on every layer every couple of seconds, yikes!

Qt's native Graphics View Framework (http://doc.trolltech.com/4.4/graphicsview.html) supports just this type of situation and does all the heavy lifting for us.  Why are we not taking advantage of this?

Currently, QgsMapCanvas instantiates a QGraphicsScene but the only item added is our QgsMapCanvasMap.  Instead, it seems like there are performance advantages to be gained by having each layer inherit from QGraphicsItem and implement its own paint().  Then only the layers that need updating can be updated and only the segment of the scene that actually changes (and is in view) will be re-drawn.

-Jae


More information about the Qgis-developer mailing list