PDA

View Full Version : Creating a scene from piece of another scene



maverick_pol
9th August 2007, 11:49
Hi,

I am trying to to implement zooming in the viewport like this:
I choose a rectangle from the current scene, then I would like to create another scene which would show only the chosen rectangle, and so on(of course I would remove the old scene from the viewport).
For now I use scale() method which scales the whole scene, and it takes about 1 or 2 sec to paint it again.
How to create a scene using a rectangle from another scene? I draw the scene contents in the background and add some items. How to copy the part of the background and items to another scene?

Thank you for any ideas.

Maverick

cerber
9th August 2007, 12:13
Hi

I guess you may use a QGraphicsScene::render method to create a copy of a rectangle in another QPaintDevice. It'll work if you don't need to copy the items themselves, but only their "view".

Or, you may copy the items which boundingRect intersects the rectangle to a new scene.
Or, you may not copy them, but just change items' parent.

Does this fit?

maverick_pol
9th August 2007, 12:33
Sound like a good solution, will test it right away.

THanks.

Maverick

maverick_pol
23rd August 2007, 18:51
Hi,

Could anyone explain how to use QGraphicsScene::render method?

m_scene - > current scene;
_rectangle -> piece of the scene(rectangle) which I want to zoom In and create the whole scene from it

How to create a new scene or replace the old scene with the _rectangle using render?

Thank you.

Maverick