A
A
aarifkhamdi2017-03-12 18:01:40
Qt
aarifkhamdi, 2017-03-12 18:01:40

What size should QGraphicsScene be set to?

There is a QMainWidget, QGraphicsView is inserted into it as a central widget.
For QGraphicView there is QGraphicScene, and for this scene you need to specify a size.
In general, I don’t understand the logic by which it is necessary to give the scene a size (and the view too). Whatever I pass there, nothing changes on my screen. I feel the difference only if there is nothing to transfer - then the size changes itself.
I want it to be like this: the scene area is the area of ​​the central widget on the screen during showMaximized(); if the mainWidget'a size is reduced, then the QGraphicView should have scrollbars, and the scene size did not change.
Not a single sketch of mine is even close to the truth, so I don’t throw my futile attempts on display.
Perhaps I'm very confused with concepts ... I'm learning :-) I hope I wrote clearly.
Hint at the implementation logic or make a small working sketch, and I'll figure it out myself. You are welcome. Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LancerX0, 2017-07-07
@LancerX0

Good afternoon.
The size of a QGraphicsScene specifies the size of the so-called "canvas". That is, the maximum available size for drawing objects, etc.
The size of the QGraphicsView determines the actual size of the widget on your screen. And if it is less than the size of QGraphicsScene, then scrollers will be displayed to move around the scene.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question