PDA

View Full Version : Widget auto shrink



been_1990
23rd January 2013, 19:35
My Widget grows according to the widget added to it's layout, but when the size of it's children change (smaller) the widget won't shrink. I've tried updating it's geometry when it's children change but to no avail.

wysota
23rd January 2013, 19:48
Resize the widget yourself or set a size constraint on the widget's layout.

been_1990
23rd January 2013, 21:24
layout->setSizeConstraint(QLayout::SetMinimumSize); Doesn't fix it.

wysota
23rd January 2013, 22:05
Why would it fix it?

been_1990
23rd January 2013, 23:08
or set a size constraint on the widget's layout
Isn't that a size constraint?

wysota
23rd January 2013, 23:57
There are more to pick from. Did you read in the docs what each of them does?

been_1990
24th January 2013, 00:08
I have, but none of them size contraints seem to do anything diferent than set maximum/minimum hight and widht.:confused:
I guess I have to do it all by hand.

wysota
24th January 2013, 00:19
Do you know what the size constraint on the layout does?

ChrisW67
24th January 2013, 00:42
Take a look at the Extension Example because it does exactly what you are asking for.

been_1990
24th January 2013, 02:43
QLayout::SetFixedSize worked. Don't know why...