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

qlayout, qt

Solution

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

Problem

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?

Original source