WHBoxLayout [doc] and WVBoxLayout [doc]

These classes provide a horizontal or vertical layout of widgets inside a WContainerWidget.

In the example below, a WHBoxLayout with default padding (9 pixels) and spacing (6 pixels) is used to manage two child widgets. If no stretch factors have been specified, space is evenly distributed to all widgets.

Item 1
Item 2

If we give Item 1 a non-zero stretch factor, then Item 2 will only use its minimum width, and Item 1 will get all remaining space, as illustrated below.

Item 1
Item 2

WVBoxLayout works in exactly the same way, but stacks children vertically.

Item 1
Item 2
Item 1
Item 2

Layout managers may be arbitrarily nested to create complex layouts. In the example below, we nested a WHBoxLayout with items 2 and 3 inside a WVBoxLayout with item 1.

Item 1
Item 2
Item 3
Events will be shown here.