[Qt-interest] Child Inherit Size of Parent

velociraptor Genjix aphidia at hotmail.com
Sun Oct 31 19:14:53 CET 2010


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

----------------------------------------
> From: sean.harmer at maps-technology.com
> To: qt-interest at trolltech.com
> Date: Sun, 31 Oct 2010 14:42:28 +0000
> Subject: Re: [Qt-interest] Child Inherit Size of Parent
>
> Hi,
>
> On Sunday 31 October 2010 14:24:57 velociraptor Genjix wrote:
> > If I parent one widget to another widget, how can I get it to inherit it's
> > parent's size?
>
> Put the child in a layout in the parent. For e.g.
>
> MyParent::MyParent( QWidget* parent = 0 )
> : QWidget( parent )
> {
> MyChild* child = new MyChild( this );
> QVBoxLayout* layout = new QVBoxLayout;
> layout->addWidget( child );
> setLayout( layout );
> }
>
> The layout will automatically resize your child when the parent is resized.
> Take a look at the examples and docs relating to the Qt Layout System.
>
> HTH,
>
> Sean
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
 		 	   		  



More information about the Qt-interest-old mailing list