Skip to content

QVBoxLayout


The QVBoxLayout class lines up widgets vertically. If the widgets do not fit in the window, the layout will automatically wrap or resize them. For a horizontal layout, see QHBoxLayout.


Methods


Examples


vbox = QtWidgets.QVBoxLayout()
textedit = QtWidgets.QTextEdit()
vbox.addWidget(textedit)
In the above example, a vertical layout is created and a QTextEdit widget is added to it using the addWidget method from the parent class QLayout.


vbox = QtWidgets.QVBoxLayout()
hbox = QtWidgets.QHBoxLayout()
vbox.addLayout(hbox)
In the above example, a vertical layout is created and a horizontal layout is added to it.



addLayout(layout)

Adds a layout to the vertical box layout. The layout will be added below the existing layouts.

Parameters:

Name Type Description Default
layout QLayout

the layout to add

required