[Qt-interest] Child Inherit Size of Parent

Sean Harmer sean.harmer at maps-technology.com
Sun Oct 31 21:25:52 CET 2010


Hi,

On Sunday 31 October 2010 18:14:53 velociraptor Genjix wrote:
> Hey,
> I don't want to layout the widget. I want to actually add the widget
> layered ON TOP of the widget below (like when you parent it to another
> widget), and have it resize together with the parent. Thanks

Erm, that's what layouts do. If none of the provided layouts meet your exact 
needs - which from the mockup appears to be to keep the child widget at approx 
1/4 of the parent size - then you can write your own simple layout class.

Alternatively, if that is to much hassle for you then you can simply do some 
manual positioning by calling child->setGeometry() in the resizeEvet() of your 
parent widget. This is just what a layout does by the way except that it does 
it in more cases than simple resizes of the parent. Liek when the size hints 
change for example.

Good luck,

Sean



More information about the Qt-interest-old mailing list