QVBoxLayout: How to vertically align widgets to the top instead of the center

sFuller picture sFuller · Apr 10, 2012 · Viewed 90.2k times · Source

In Qt, When I add widgets to my layout, they are vertically centered by default. Is there a way to "List" the widgets from top to bottom instead of centering them vertically?

Answer

Kunal picture Kunal · Apr 10, 2012

use void QLayout::setAlignment ( Qt::Alignment alignment ) method to set alignment according to your choice.