[Interest] QGraphicsItem/QGraphicsView - boundingRegion

Boettger, Heiko Heiko.Boettger at karlstorz.com
Tue Oct 6 16:08:37 CEST 2015


Thanks Christian, 

in the meantime I found out that there is a QBackingStore which seems to provide similar functionality. At least there is an update method which works on regions. Actually what I try to archive is reducing the overall time required to repaint a whole window as well as to redraw a single line. When switching from qt4 to qt5 the performance on our arm926 based hardware dropped significantly. There is a big delay every time new window is opened. The performance directly depends on the size of the rectangle. One big issue there is that the only tool I have for profiling is the gperftool, valgrind doesn't run there.

My first though was to use multiple rectangle describing the updated region in order reduce the area/number of pixel that needs to repainted. However since repainting the whole windows is also awful slow on that device, I am not sure that this is the solution.

Do have any experience with degreased performance when switching from qt4 to qt5?  May be there is just an option to disable a newly added feature such as alpjha blending/transparency which may be now enabled by default.

Best Regard

Heiko Böttger

-----Ursprüngliche Nachricht-----
Von: Chris Gagneraud [mailto:chgans at googlemail.com] Im Auftrag von Christian Gagneraud
Gesendet: Montag, 5. Oktober 2015 23:23
An: interest at qt-project.org
Cc: Boettger, Heiko
Betreff: Re: [Interest] QGraphicsItem/QGraphicsView - boundingRegion

On 06/10/15 00:48, Boettger, Heiko wrote:
> Hi,
>
> while looking for a way to optimize the performance on out hardware I 
> found the following blog entry:
>
> http://blog.qt.io/blog/2008/01/08/accurate-update-regions-for-thin-qgr
> aphicsitems/

That's quite an old article (2008).

I think there are talking about these:
http://doc.qt.io/qt-5/qgraphicsitem.html#setBoundingRegionGranularity
http://doc.qt.io/qt-5/qgraphicsitem.html#boundingRegion

They have been added in Qt 4.4, which is the Qt version mentioned in the article.

A simple optimisation is to cache the values returned by boundingRect() and shape() since these function members are called very often (at least in my case).

How you tune your view/scene/items depends on the typical use case (animated or not, few vs millions of items, big vs small items, ...)

My 2 cents,
Krys

>
> It's about using a boundingRegion which consist out of multiple 
> rectangle in order to reduce the number of pixel to be painted. 
> However after looking deeper I got stuck when trying to find out where 
> this method is actually called. I used grep to find occurencies of 
> "boundingRegion" but the only related call which I could found was in
>
> QRegion QGraphicsViewPrivate::mapToViewRegion(const QGraphicsItem 
> *item, const QRectF &rect) const
>
> and that method doesn't seem to be called from code inside qt.
>
> My question is now, does this still work in qt 4.8.7 or 5.4.0? If yes, 
> can someone point out where to find information how it works? I am 
> interested in the requirements for the CacheMode or other properties 
> to make it work. Does the QGraphicsView automatically create such a 
> boundingRegion based on the existing QGraphicItems places inside?
>
> Many thanks in advanced.
>
> Heiko Böttger
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>




More information about the Interest mailing list