PDA

View Full Version : Scrolling widgets



enricong
21st June 2012, 19:52
I have a rectangular area at the bottom of my application. I would like to horizontally add a list of "tiles" (vertically a QLabel and a QGraphicsView). As I add tiles (problematically) I'd like a horizontal scrollbar to appear. The aspect ratio needs to be fixed. They can resize larger if the height grows.

I setup a QGridLayout then in my software I simply do "layout->addWidget(....)" adding to the correct rows and columns.

However this just squeezes everything into the view instead of adding a scrollbar and the aspect ratio is maintained.

Is there a scrolling layout I can use?

wysota
21st June 2012, 20:53
QScrollArea

enricong
21st June 2012, 21:20
I tried to use a qscrollarea
However, I still have a layout in the scroll area which wants to take up 100% of the space.
therefore nothing scrolls, everything just gets squeezed in.

I'd like the aspect ratio of each tile to be maintained and the size to be constrained by the height of the scroll area.

wysota
21st June 2012, 21:23
Set "widgetResizable" property to true. As for resizing, use height-for-width mechanism or do the resizing yourself.