PDA

View Full Version : QScrollView with a QVboxlayout



rishid
18th January 2008, 00:46
I am trying to figure out if this is the right technique for what I want to do. I basically want a scrollable vertical box layout, but cannot seem to figure it out. The problem with using Vboxlayout is that is resizes the widgets I put in it, I want the size to be fixed with a scroll bar. This possible anyway? Been trying to figure this out for 2 days and still lost.

Edit: Another thing is that I need to be able to add and remove widgets in real-time.

Thanks

jpn
18th January 2008, 16:14
I am trying to figure out if this is the right technique for what I want to do. I basically want a scrollable vertical box layout, but cannot seem to figure it out. The problem with using Vboxlayout is that is resizes the widgets I put in it, I want the size to be fixed with a scroll bar. This possible anyway? Been trying to figure this out for 2 days and still lost.
Yes, it's possible. Just fill the layout, install on a widget and use QScrollArea::setWidget().


Edit: Another thing is that I need to be able to add and remove widgets in real-time.
Add the widget to the layout and call QWidget::adjustSize() on the container widget (not the scroll area widget but the widget that contains those child widgets).