QVBoxLayout inside a QScrollArea Issues



  • I have a panel that I want to fill with widgets. But it will most likely overflow the panel size. So it makes sense to make the panel scroll if the content overflows.

    I set up a QScrollArea and put a QVBoxLayout inside of it. I am finding that the QVBoxLayout restricts the size of the content. Here's the my form looks like QT designer:

    !http://i.imgur.com/RS8YHvt.png()!

    And here is what the program looks like running:

    !http://i.imgur.com/fPr4k2A.png()!

    Now, I can go in and hand modify the QVBoxLayout in designer and make it bigger and it works. But this feels like a hack. There's gotta be a way for the QVBoxLayout to automatically expand. I tried turning a lot dials everywhere and nothing seems affect this. What am I missing?



  • Hard to say without seeing the code, but the problem may be that what is holding vbox is not resizing. Looks like you need a GridLayout for the main area you show. You then need to make sure the row/column that holds the widget you want to grow is scaling by setting the row /col stretch values to 1 or more. If you want that row to receive all the stretch then set the other row stretch values to 0


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.