PDA

View Full Version : QGraphicsView question



sincnarf
4th July 2007, 09:04
can QGraphicsView hold several QGraphicsScenes at a time? or it's only true for QGraphicsItems?

a_m_mukul
4th July 2007, 09:10
QGraphicsView can't hold many QGraphicsScenes simultaneously.

And QGraphicsItems are related to QGraphicsScene not QGraphicsView.

The exact scenario is as follows:

- QGraphicsScene may contains single or multiple graphicsItems.
- One graphicsview can display only one graphicsscene at a time.

jpn
4th July 2007, 09:12
can QGraphicsView hold several QGraphicsScenes at a time?
No, a QGraphicsView represents a single QGraphicsScene. You can adjust QGraphicsItem::zValue() if you want to make layers.

xgoan
4th July 2007, 09:23
Also, you can have multiples scenes in memory and change them in the GraphicsView

Bitto
4th July 2007, 20:48
Technically it's possible to write a QGraphicsSceneItem, if you want multiple scenes inside the same view. If you don't mind skipping the scrollbars, you do have everything available in QGraphicsScene's API to make an item:

QGraphicsItem::boundingRect: returns anything suitable / a subscene rect.
QGraphicsItem::paint: calls QGraphicsScene::render().

We actually have a registered suggestion for such an item, and we might provide one for 4.4.