[Qt-interest] Child Inherit Size of Parent

Mark Stevens troll-tech at aspamtrap.com
Sun Oct 31 21:35:37 CET 2010


On 10/31/2010 11:16 AM, velociraptor Genjix wrote:
>
> This picture will clarify (notice the text doesn't become smaller but the box does): http://www.qtcentre.org/attachment.php?attachmentid=5413&d=1288469631
>
> ----------------------------------------
>> 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
>   		 	   		
I think you want a signal from the parent to the child on the resize 
event. Don't remember if I have done it before though.

Janaka Stevens



More information about the Qt-interest-old mailing list