How do I make QScrollArea consume available vertical space inside a QVBoxLayout?
I have a QScrollArea wrapping a custom widget (with children laid out by a QVBoxLayout), and the QScrollArea is itself laid out by a QVBoxLayout. The wrapped widget is large enough to make a vertical scroll bar appear. Basically the (Python) code is like this:
layout = QtWidgets.QVBoxLayout(parent_widget)
form_scroll = QtWidgets.QScrollArea()
form_widget is a custom widget with children laid out by QVBoxLayout
My problem is that the QScrollArea doesn't expand to consume available space in the vertical direction (horizontally it's fine). How do I make it expand vertically?
I found the reason, which wasn't evident before the QScrollArea was introduced: I had called addStretch(1) on the layout object, which compressed the laid out widgets (including the QScrollArea).