View Full Version : filling scrollview

17th February 2006, 21:14
hi all,

does anyone know how to fill a scrollview with its contents when its contents are smaller than the viewport?

i've got 5 widgets laid out horizontally. when the viewport is short there's a scrollbar, great. however, when the viewport is taller than the widgets, there's just a gray space taking up the extra room instead of resizing the widgets. i tried various combinations of layouts as children of the viewport and scrollview, but nothing expands my widgets.

any ideas?

17th February 2006, 23:00
well, i don't like creating extra widgets if i don't have to, but i solved this problem by creating one frame that contains my 5 widgets. then i added a layout to the frame.

for the scrollview, i did

setResizePolicy (QScrollView::AutoOneFit);which works great with one child. it doesn't work if there's more than one child widget of the scrollview, but putting them all in a frame means now there is only one direct child (with lots of grandchildren).

just fyi.