2 Attachment(s)
QGraphicsItem goes out of scene
Hi,
I have a 2 custom QGraphicsItem say MainGraphicsItem and AttachedGraphicsItem.
MainGraphicsItem has many children of type AttachedGraphicsItem (MainGraphicsItem is the parent AttachedGraphicsItem)
All these items are in a scene (the scene expands automatically).
Consider MainGraphicsItem as a rectangle and AttachedGraphicsItem as a small circle. They are arranged as shown in the attached image.
Attachment 9264
Now when I move MainGraphicsItem to the right edge of the scene the AttachedGraphicsItem go out of the scene and are not visible. (Please see pic 2)
Attachment 9265
The scene doesn't expand in this case.
Can you please resolve the issue.
Re: QGraphicsItem goes out of scene
Why do you say the scene doesn't expand? Since scroll bars appear it seems that it does.
Re: QGraphicsItem goes out of scene
Sorry for creating the misunderstanding. What I meant was, the scene expands when the MainGraphicsItem goes out of the scene, but it doesn't when AttachedGraphicsItem go out of the scene. As seen in the second image some AttachedGraphicsItem are cut (out of scene). The scroll bars have been completely scrolled to right.
Re: QGraphicsItem goes out of scene
Are those small items children of the bigger item?
Re: QGraphicsItem goes out of scene
Yes ..
Small Items (AttachedGraphicsItem) are children of Big Item (MainGraphicsItem).
MainGraphicsItem can have multiple children of type AttachedGraphicsItem.
Re: QGraphicsItem goes out of scene
I think the scene has no direct way of tracking items that are not directly its own children. You might have to react to position change of the main item and make the scene grow yourself.