PDA

View Full Version : A perfect solution for complex painting



maverick_pol
3rd August 2007, 10:48
Hi guys,

I have to draw a map (vector format) and be able to resize it/scroll/detect colision between some objects. There is a background that do not changes and a lot of objects(items) a huge number of them(maybe about a milion of them) on the map.
I have chosen the QGraphicsView/Scene but I am not sure it I have chosen the best possible option.
While zooming int/out/ and using methods like: QGraphicsView::fitInView(QRectF), QGraphicsView::scale(..) there are delays or even the app halts.
Also when I move the cursor on the view/scene the CPU usage increases fast.

I hope that the painting using the view/scene can be optimized, but yet do not know how to achieve the best result.


THank you for any ideas,

Maverick

marcel
3rd August 2007, 13:39
1 million items?
I am sure QGraphicsView can handle that too, but you need a pretty good computer.
You cannot be serious when you ask it to behave for 1 million items like it behaves for 40000 or whatever.
There are complex operations going on on the back of a QGraphicsScene, especially if you need collision detection.

Regards

Gopala Krishna
3rd August 2007, 14:04
You can optimize at various places when using gv. But unless and until you profile your applications there is nothing specific to do. If you post the profile result, we may be able to help you. Ofcourse posting code too will help us to help you :)