qvboxlayout - layout manager that arranges widgets vertically
Name
qvboxlayout — layout manager that arranges widgets vertically
Syntax
qvboxlayout cmds...
Description
The qvboxlayout command creates a QVBoxLayout object, making it the active layout manager. This layout manager will automatically arrange widgets vertically. Call qvboxlayout followed by the creation of the widgets.
Call qsetmargin to adjust the margin between the stacked widgets and the widget containing them or use qsetspacing to adjust spacing between the stacked widgets.
For non-trivial layouts consider nesting widgets inside QWidgets that contain their own layout. This way you can simulate having one layout manager inside another, allowing for mixed vertical and horizontal layouts. This technique is shown in Nested Layout.
See also qhboxlayout and qgridlayout.
Arguments
cmds
A block containing arguments, typically the widgets to be contained inside the layout.
Examples
Ex.1: QVBoxLayout
set w [qwidget] qsetwindowtitle "QVBoxLayout" qvboxlayout { qlabel "Label 1" qlabel "Label 2" } qshow $w
Ex.2: Nested Layout
set w [qwidget] qsetwindowtitle "Nested QHBoxLayout" qvboxlayout { qlabel "Label 1" # Add two horizontally positioned labels between "Label 1" and "Label 2" qaddhboxlayout { qlabel "Inner label 1" qlabel "Inner label 2" } qlabel "Label 2" } qshow $w
Example Nested Layout shows a QHBoxLayout nested inside a QVBoxLayout.