Qt-interest Archive, October 2007
Layout not adjusting to children's change in size at runtime?
Message 1 in thread
I have a combo box that has items (including the current selection)
whose items can change based on user configuration (thus the widget
changes size). I have tried putting the combo box in various layouts,
and calling update, etc. when the text changes, but the layout doesn't
resize around the widgets. I've tried setting the minimum size of the
combo box, but the layout isn't honoring it.
I've scoured the Qt docs and the web to no avail. Any idea what I might
be missing? Essentially what I want to do is cause the layout to
re-layout when the size of a child widget changes.
Thanks in advance,
Susan Macchia
--
[ signature omitted ]
Message 2 in thread
I have tried ::updateGeometry on the parent widget, ::activate on the layout. Neither works. Any ideas anyone?
TIA,
Susan
Susan Macchia wrote:
I have a combo box that has items (including the current selection)
whose items can change based on user configuration (thus the widget
changes size). I have tried putting the combo box in various layouts,
and calling update, etc. when the text changes, but the layout doesn't
resize around the widgets. I've tried setting the minimum size of the
combo box, but the layout isn't honoring it.
I've scoured the Qt docs and the web to no avail. Any idea what I might
be missing? Essentially what I want to do is cause the layout to
re-layout when the size of a child widget changes.
Thanks in advance,
Susan Macchia
--
[ signature omitted ]
Message 3 in thread
Try: layout->setSizeConstraint(QLayout::SetFixedSize);
--
[ signature omitted ]
Message 4 in thread
Unfortunately, the combo is with other widgets that can change size.
After a lot of experimenting I ended up using an QHBoxLayout and doing
some calculations - setting the min size on widgets that can change
dynamically. I'll probably create a small reproducer to sent to
Trolltech for advice, or perhaps there's a bug here.
J-P Nurmi wrote:
> Try: layout->setSizeConstraint(QLayout::SetFixedSize);
>
--
[ signature omitted ]