How to avoid calling boundingRect() & shape()
Hi,
I am using GraphicsView to display 15,000 > rectangle & 20,000 > lines joining them.
But rendering speed is too slow ...I checked chip example but chip seems too fast as compare to my application. Even though chip is having more items on screen than my application.
Can anybody tell me how to make it fast ??? any flag need to set ???
Also boundingRect() & shape() function are getting called too many times. Can we avoid calling these functions to improve performance/rendering ? and how ??
Re: How to avoid calling boundingRect() & shape()
Well, bitto suggested in a similar post to increase the scene's bspTreeDepth property. If you try this, make sure first that itemIndexMethod is BspTreeIndex.
Re: How to avoid calling boundingRect() & shape()
By default item index method is BspTreeIndex, but as I want to move rectangles and lines adjoined it, it becomes very slow .
Can you suggest any other method so that I can use to rendering.
Also loading time is also too slow. How we can add items in Scene fastly & render it ?
Re: How to avoid calling boundingRect() & shape()
Quote:
Can anybody tell me how to make it fast ??? any flag need to set ???
add
setViewport(new QGLWidget);
in your constructor to make it fast.
Re: How to avoid calling boundingRect() & shape()
Quote:
Originally Posted by
nileshsince1980
By default item index method is BspTreeIndex, but as I want to move rectangles and lines adjoined it, it becomes very slow .
Can you suggest any other method so that I can use to rendering.
Also loading time is also too slow. How we can add items in Scene fastly & render it ?
Have you increased bspTreeDepth?
Re: How to avoid calling boundingRect() & shape()
how to set setBspTreeDepth property for scene items ???
Also I have tried setViewport(new OpenGLWidget) but it slowa down rendering,
Is there is another way to make fast rendering ??
Re: How to avoid calling boundingRect() & shape()
http://labs.trolltech.com/page/Proje...ys/DevDays2007
The gv presentation might give you some tips to improve rendering speed.
Have you cached the values to be returned in boundingRect() and shape() ? Probably you can inline them..
Also have you profiled your app and tried to find out where exactly it is being slow ?
P.S: Did you try out all the suggestions mentioned in the previous threads in this forum ?
Re: How to avoid calling boundingRect() & shape()
I have had cases where NoIndex was significantly faster than BspTreeIndex. If not, play around with bspTreeDepth().
Gopala's suggestion to cache bounding rects and shapes is also a good one. Most of the examples show calculating rects and shapes on the fly, but this is not good. Put a QRectF and a QPainterPath member in your item, and return them when requested. Also keep your shapes simple. Sometimes a loose approximation of the shape is sufficient.