View Full Version : Creating new scene from a part of an old one

28th November 2007, 10:26
Hi gusy,

I have a scene with custom background showing the world. When I zoom In the coordinates system changes and the whole scene is zoomed In. I choose a rectangle which should be zoomed and use "QGraphcsView::fitInView(QRectF)". But this work to slow and I do not want to zoom in the whole scene, especially when only the chosen(zoomed) rect will be visible. I thaught about creating a new scene from the chosen rectangle, hiding the (whole world scene) and setting View's new scene,etc.
First of all, I would like to ask do you think this is a good idea? If not, I would really appreciate if you could share your other ideas.

If this approach is ok, howto create a new scene from a part of the old scene? (the new scene should show the part of old scene background + items from that area).

Thank you for any help.


Yet zooming in the whole world is just to slow.

28th November 2007, 17:45
What is causing the slowdown? If you zoom the view, items are not changed and those outside the visible rectangle are not affected in any way... You should have an increase in speed, not a slowdown...

28th November 2007, 17:56
Still, it works slower. Will look at the code and give more details.

28th November 2007, 17:59
Do you cache the background?

28th November 2007, 18:02
yes, because the background is built of about 3000 polygons,


28th November 2007, 18:29
I suggest you use cachegrind or gprof to find the bottleneck.

28th November 2007, 19:14
will do as suggested and reply later.