Hi,
On 14.06.2016 15:14, Igor Mironchik wrote:
Hello.
I'm working on project that use QGraphicsView.
I interactively group child elements (items) and ungroup. Everything
is fine, but when I do ungroup, sceneRect in view increases. Look:
scene QRectF(0,0 800x630) form pos QPointF(0,0)
sceneRect QRectF(-5,-5 805x640)
sceneRect QRectF(-5,-5 805x640) <-- Normal state
sceneRect QRectF(-5,-186 805x821) <-- Here I did ungroup and sceneRect
increased.
sceneRect QRectF(-5,-186 805x821)
sceneRect QRectF(-5,-186 805x821)
sceneRect QRectF(-5,-186 805x821)
scene QRectF(0,0 800x630) form pos QPointF(0,0) <-- But scene's
itemsBoundingRect() is unchanged.
What it can be? Thank you.
I found in the docs:
sceneRect: QRectF <../qtcore/qrectf.html>
This property holds the scene rectangle; the bounding rectangle of the
scene.
The scene rectangle defines the extent of the scene. It is primarily
used by QGraphicsView <qgraphicsview.html> to determine the view's
default scrollable area, and by QGraphicsScene <qgraphicsscene.html> to
manage item indexing.
If unset, or if set to a null QRectF <../qtcore/qrectf.html>,
sceneRect() will return the largest bounding rect of all items on the
scene since the scene was created (i.e., a rectangle that grows when
items are added to or moved in the scene, but never shrinks).
And this "never shrinks" is the root of the problem. So my question is
how to shrink sceneRect() to the normal size? Thank you.
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest