qtqlayout

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


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?


Solution

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