문제

I have a QtGui.QVBoxLayout widget which exists inside a main QtGui.QGridLayout layout, which extends and centers the items all over the place (The left side)

I want the items to get stacked up at the top of the widget (The right side)

enter image description here

How can I achieve this? I know it has something to do with SizeHint, but I'm not sure how to use it.

도움이 되었습니까?

해결책

A QBoxLayout will distribute the widgets evenly over the available space. The easiest way to keep all the widgets packed together at the top of a QVBoxLayout, is to add a stretchable spacing at the bottom that will push all the widgets up.

You can add a stretch that will take up as much space as it can with QBoxLayout::addStretch().

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top