[Interest] Changing the Layout of a Widget

Michael Jackson imikejackson at gmail.com
Thu Jun 28 23:12:07 CEST 2012


Thanks. That seemed to have done it with some careful pointer checking. 

Thanks
Mike Jackson
On Jun 28, 2012, at 3:52 PM, Jeff Heyob wrote:

> Mike,
> 
> Call layout() to get the current layout and delete it so that the widget
> releases ownership.
> Then setLayout(...) will work.
> If you need to reuse the previous layout you will need to make a deep copy
> first before deleting it.
> 
> Cheers,
> 
> Jeffrey J. Heyob | SAIC
> Senior Software Engineer | Exploitation Technologies Division
> phone: 937-431-2308 | mobile: 937-367-1168
> Jeffrey.J.Heyob at saic.com | <http://www.saic.com>
> 
> 
> 
> 
> On 6/28/12 3:45 PM, "Michael Jackson" <imikejackson at gmail.com> wrote:
> 
>> I would like to swap layouts in a QWidget. Is that possible? I see the the
>> setLayout(...) and layout() functions but when I try to set my layout using
>> setLayout() I get an error message saying that there is already a layout. Ok,
>> Sounds reasonable. There doesn't seem to be any "removeLayout()" method
>> though. I tried setLayout(NULL) that I got another error saying setting a
>> layout to 0 is not allowed.
>>  The issue is that depending on what is present I would like to display a
>> QLabel that is better laid out with a Grid Layout and some spacers rather than
>> my current VerticalLayout scheme.
>> 
>> Searching google indicates that this may not really be possible.
>> 
>> Thanks for any advice.
>> ----
>> Mike Jackson
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
> 




More information about the Interest mailing list