[Interest] QGraphicsView & QGraphicsScene
Igor Mironchik
igor.mironchik at gmail.com
Tue Jun 14 14:28:48 CEST 2016
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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160614/b8c27b00/attachment.html>
More information about the Interest
mailing list