PDA

View Full Version : let parent widget grow with child widget?



BeS
17th February 2009, 10:52
Hello,

i have a widget which is the main window of my application. In this widget i have several other widgets. One of them should always be in a specific width/height ratio. I achieved that be overwriting of resizeEvent ( QResizeEvent * event ) of this child widget.

Basically it works but now this widget can grow out of it boundaries.
The layout management typically takes care that the child widgets shrink/grow with the parent. But now i would need something which makes the parent shrink/grow if a child widget requests more/less space.

Do you have any idea how i could achieve that?

Thanks!

aamer4yu
17th February 2009, 11:08
Send a signal from the child, catch in the parent, and resize it according to the signal :)

BeS
17th February 2009, 11:12
Hi aamer4yu,

sounds easy. :-) But the remaining question is: How do i know to which values the parent should be resized? Besically it should be resized that all child fit into it and that the parent is neither to small nor to large. But how do i tell this the parent?

^NyAw^
17th February 2009, 11:17
Hi,

Take a look at my post that I was asking the same:
http://www.qtcentre.org/forum/f-qt-programming-2/t-resize-widget-force-layout-resizing-18657.html