PDA

View Full Version : changing layout



damiano19902
30th May 2009, 18:51
is it possible to change layout in QWidget when i have set one before? do i need to unset the first before setting new one?

Lykurg
30th May 2009, 19:18
Hi damiano19902,

use the designer to access the docs. For Qt they are really great and well documented. And yes you must first delete an old set layout befor you can use a new one.

If there already is a layout manager installed on this widget, QWidget won't let you install another. You must first delete the existing layout manager (returned by layout()) before you can call setLayout() with the new layout.

Lykurg

damiano19902
30th May 2009, 21:40
whats the best way to delete it?

Lykurg
30th May 2009, 22:20
whats the best way to delete it?

simple use delete.


QLayout oldLayout = layout();
if (oldLayout) // paranoic check
delete oldLayout;
QXYZLayout *newLayout = new QXYZLayout;
//... populate the layout
setLayout(newLayout);