[Qt-interest] can not set Layout correctly
Tony Rietwyk
tony.rietwyk at rightsoft.com.au
Wed Aug 25 11:02:32 CEST 2010
Hi Bo and Yangzhi,
This line is still going to cause problems, if the ancestor class has
already set a layout:
> mHLayout = new QHBoxLayout(this);
Normally, I would do:
mHLayout = new QHBoxLayout();
...
delete layout();
setLayout( mHLayout );
But in this strange case, Yangzhi needs to do:
setLayout( 0 );
setLayout( mHLayout );
Yangzhi - your first example should have shown a Qt warning for not being
able to set the second layout. Do not ignore Qt warnings!
Tony.
More information about the Qt-interest-old
mailing list