View Full Version : Scrollable QLayout

7th June 2010, 11:30
Hi! I created a toolbar where I add buttons in a QVBoxLayout. It happens that the QVBoxLayout cannot place all the buttons inside the layout. Would it be possible to insert the layout in a QScrollArea so that, in case the layout cannot place all the buttons, it automatically creates the scrollbar to scroll the buttons?

7th June 2010, 15:19
Did you try it?

7th June 2010, 15:26
What? Placing all the buttons? Yes, it resizes the buttons, but I can't allow this.

2nd August 2010, 12:43
I have similar kind of situation where instead of buttons I have widgets but not listWidgets. Does anyone have any idea how it can be done.

2nd August 2010, 13:58
You can set the size policy of the buttons so that they dont increase in size.
QScrollArea should be fine.

2nd August 2010, 15:49
I did something similar to this with checkboxes...

I ended up putting a QFrame inside a QScrollArea... Adding a vbox layout to the frame and then adding my checkboxes to the layout gave the results that you are looking for...

I'm kind of new to Qt though so others might know a better way to do it...