I have a
QGraphicsEllipseItemobject, which is randomly positioned, and I would like it not to go beyond the
QGraphicsViewborders, which are the same of the Window.
I think I should make the
QGraphicsSceneexactly the same size of the
QGraphicsView, but so far I failed to do that, and I am not sure that this is the correct way to do it.
Does anyone have a suggestion how to do it? I would appreciatte any reference too.
how about passing the
Thanks for your time!
I tried to combine the two methods, but I failed to. Would you have an example?
The "extension" of the graphics scene is the combined extension of all its objects (ellipses). In the graphics view you can set the area (rect) of the graphics scene that you want it to show with:
So you will have to define a rectangle in which to vary the ellipses and set the view to show this rectangle; and make the widget big enough to show the complete view, otherwise you will get scrollbars.
Thanks for your time.
That's pretty much what I am doing.
I set the
QGraphicsViewto show no scroll bars, and the
QGraphicsScenewidth and height to 95% of the