I'm working on a GUI that requires a scrollable QGridLayout based on the size of the window. My solution was to nest that within a QScrollArea. This works as long as I'm only adding standard widgets to the QGridLayout.
When I switch to adding my widgets to a QFrame and then adding that frame to the gridlayout as before the gridlayout no longer scrolls, instead just squishing all rows of the gridlayout as much as needed to include them all.
Why is this? Is there a fix or a different way to do this? I should mention the only reason I'm using a QFrame is to stylize the backgroun开发者_如何学编程d, amongst other things, of the "cell" that is created when adding a widget to a grid layout.
This will happen if your widget is not asserting appropriate minimum sizes via its size hints and size policies.
精彩评论