PDA

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



maverick_pol
28th November 2007, 09: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.

P.S.

Yet zooming in the whole world is just to slow.

wysota
28th November 2007, 16: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...

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

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

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


m_view->setCacheMode(QGraphicsView::CacheBackground);

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

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