PDA

View Full Version : QVLayoutBox doesn't expand as widgets are added?



johnwheez
20th July 2008, 19:28
Hi all,

I have the following UI heirarchy:

A QVBoxLayout is a child of the QScrollArea

I want to add widgets in to the QVBoxLayout when a user pushes a button.

Currently the system works but, as I add more widgets in to the QVBoxLAyout, the QVBoxLayout doesn't expand in size and the widgets are drawn closer and closer together until finally, they are not visible at all.

Is there a method I need to call so that the QVBoxLayout grows as more widgets are added in to is?

Thanks for any tips.

jpn
20th July 2008, 20:47
Install the vbox layout on a plain QWidget and set it inside the scroll area with QScrollArea::setWidget(). Call QWidget::adjustSize() on that widget after adding new widgets.