Qt-interest Archive, August 2007
Catch when a QGraphicsView is resized
Message 1 in thread
Hi,
I've got a QGV with a scene that draw stuff relative to the size of the view.
When the size of the view changes, I want to redraw the contents, so that everything stays the same distances from each other (relatively speaking). Now, if I resize the view, the contenst get shifted in the direction that you resize. No fun. I have tried finding out if QGV emits a signal when it resizes, but so far I've come up with nothing. Did I miss somethings, or does not any such signal exist?
Example of what I want to do:
Say you have one item centered in the scene, and one in each corner.
When I resize I want them so stay exactly how they are, that is one in each corner + one in center, but with a greater distance between them.
My items are already drawn in accordance to the size of the view. All I need is a way to catch when the view change size.
Any help would be appreciated.
--
[ signature omitted ]
Message 2 in thread
Christopher Rasch-Olsen Raa wrote:
>
> Hi,
>
> I've got a QGV with a scene that draw stuff relative to the size of the
> view. When the size of the view changes, I want to redraw the contents, so
> that everything stays the same distances from each other (relatively
> speaking). Now, if I resize the view, the contenst get shifted in the
> direction that you resize. No fun. I have tried finding out if QGV emits a
> signal when it resizes, but so far I've come up with nothing. Did I miss
> somethings, or does not any such signal exist?
>
> Example of what I want to do:
> Say you have one item centered in the scene, and one in each corner.
> When I resize I want them so stay exactly how they are, that is one in
> each corner + one in center, but with a greater distance between them.
>
> My items are already drawn in accordance to the size of the view. All I
> need is a way to catch when the view change size.
>
> Any help would be appreciated.
Maybe you can try to use QWidget::resizeEvent(), either by subclassing your
QGraphicsView or by installing an eventfilter on it.
André
--
[ signature omitted ]