PDA

View Full Version : Dialog



gyre
21st November 2007, 19:43
Hi guys...again me...I've desgined a dialog TO which I add/remove widget upon clicking on particular add/remove button (widgets add it to it are added on fly right after I click on add button...they are removed right after I click remove button and widgets have its checkbox checked)...the problem is that the groupbox in which the new widgets are added changes its size only when adding them but when I remove a widget(s) it preserves its size and dont decreases it accordingly...
Is there a property that has to be set so it would decrease its size when a widget is removed from that groupbox ? it increases its size when the new widget is added...but not decrease accordingly its size when a widgets is/are removed
Thanks
I designed that dialog with qtdesigner and the widget that is added to dialogs GroupBox too

I tried to set the size policy to minimum and so on but it didnt work...

wysota
21st November 2007, 20:20
It should work out of the box. There must be something wrong with your code. Did you remember to apply a layout to the dialog?

gyre
21st November 2007, 21:26
yes I did...I even managed to fix this problem with setting one of the layout's attributes:
setSizeConstraint(QLayout::SetMinAndMaxSize);
but you have to set the min and max sizes of your widgets...

wysota
21st November 2007, 21:39
You meant the dialog was not shrinking? I thought you meant the groupbox... Yes, the dialog won't shrink by itself without applying a constraint on the top level layout.