PythonQt.Qt.QBoxLayout
QBoxLayout
PythonQtInstanceWrapper object
Native bases: PythonQtInstanceWrapper
Supplemental documentation: Qt 5 reference:
Detailed Description
QBoxLayout takes the space it gets (from its parent layout or from the parentWidget()), divides it up into a row of boxes, and makes each managed widget fill one box.

If the QBoxLayout's orientation is Qt::Horizontal the boxes are placed in a row, with suitable sizes. Each widget (or other box) will get at least its minimum size and at most its maximum size. Any excess space is shared according to the stretch factors (more about that below).

If the QBoxLayout's orientation is Qt::Vertical, the boxes are placed in a column, again with suitable sizes.
The easiest way to create a QBoxLayout is to use one of the convenience classes, e.g. QHBoxLayout (for Qt::Horizontal boxes) or QVBoxLayout (for Qt::Vertical boxes). You can also use the QBoxLayout constructor directly, specifying its direction as LeftToRight, RightToLeft, TopToBottom, or BottomToTop.
If the QBoxLayout is not the top-level layout (i.e. it is not managing all of the widget's area and children), you must add it to its parent layout before you can do anything with it. The normal way to add a layout is by calling parentLayout->addLayout().
Once you have done this, you can add boxes to the QBoxLayout using one of four functions:
- addWidget() to add a widget to the QBoxLayout and set the widget's stretch factor. (The stretch factor is along the row of boxes.)
- addSpacing() to create an empty box; this is one of the functions you use to create nice and spacious dialogs. See below for ways to set margins.
- addStretch() to create an empty, stretchable box.
- addLayout() to add a box containing another QLayout to the row and set that layout's stretch factor.
Use insertWidget(), insertSpacing(), insertStretch() or insertLayout() to insert a box at a specified position in the layout.
QBoxLayout also includes two margin widths:
- setContentsMargins() sets the width of the outer border on each side of the widget. This is the width of the reserved space along each of the QBoxLayout's four sides.
- setSpacing() sets the width between neighboring boxes. (You can use addSpacing() to get more space at a particular spot.)
The margin default is provided by the style. The default margin most Qt styles specify is 9 for child widgets and 11 for windows. The spacing defaults to the same as the margin width for a top-level layout, or to the same as the parent layout.
To remove a widget from a layout, call removeWidget(). Calling QWidget::hide() on a widget also effectively removes the widget from the layout until QWidget::show() is called.
You will almost always want to use QVBoxLayout and QHBoxLayout rather than QBoxLayout because of their convenient constructors.
Source: https://doc.qt.io/archives/qt-5.15/qboxlayout.html
Complete member index
Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.
| Member | Kind | Signature | Summary |
|---|---|---|---|
BottomToTop |
attribute | Any |
(shared captured text) |
Direction |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
Down |
attribute | Any |
(shared captured text) |
LeftToRight |
attribute | Any |
(shared captured text) |
RightToLeft |
attribute | Any |
(shared captured text) |
SetDefaultConstraint |
attribute | Any |
(shared captured text) |
SetFixedSize |
attribute | Any |
(shared captured text) |
SetMaximumSize |
attribute | Any |
(shared captured text) |
SetMinAndMaxSize |
attribute | Any |
(shared captured text) |
SetMinimumSize |
attribute | Any |
(shared captured text) |
SetNoConstraint |
attribute | Any |
(shared captured text) |
SizeConstraint |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
TopToBottom |
attribute | Any |
(shared captured text) |
Up |
attribute | Any |
(shared captured text) |
__init__ |
function | (self, *args: Any, **kwargs: Any) -> None |
Native constructor; consult class documentation for supported overloads. (shared captured text) |
activate |
function | (self) -> bool |
X.activate() -> bool (shared captured text) |
addChildLayout |
function | (self, l: Any) -> Any |
(shared captured text) |
addChildWidget |
function | (self, w: Any) -> Any |
(shared captured text) |
addItem |
function | (self, arg__1: Any) -> None |
Reimplements: [QLayout::addItem](https://doc.qt.io/archives/qt-5.15/qlayout.html#addItem)(QLayoutItem *item). (shared captured text) |
addLayout |
function | (self, layout: Any, stretch: int) -> None |
X.addLayout(layout, stretch) (shared captured text) |
addSpacerItem |
function | (self, spacerItem: Any) -> None |
Adds spacerItem to the end of this box layout. (shared captured text) |
addSpacing |
function | (self, size: int) -> None |
Adds a non-stretchable space (a [QSpacerItem](https://doc.qt.io/archives/qt-5.15/qspaceritem.html)) with size size to the end of this box layout. (shared captured text) |
addStretch |
function | (self, stretch: int) -> None |
Adds a stretchable space (a [QSpacerItem](https://doc.qt.io/archives/qt-5.15/qspaceritem.html)) with zero minimum size and stretch factor stretch to the end of this box layout. (shared captured text) |
addStrut |
function | (self, arg__1: int) -> None |
Limits the perpendicular dimension of the box (e.g. height if the box is [LeftToRight](https://doc.qt.io/archives/qt-5.15/qboxlayout.html#Direction-enum)) to a minimum of size. (shared captured text) |
addWidget |
function | (self, arg__1: Any, stretch: Any, alignment: Any) -> None |
X.addWidget(arg__1, stretch, alignment) (shared captured text) |
adoptLayout |
function | (self, layout: Any) -> bool |
X.adoptLayout(layout) -> bool (shared captured text) |
alignment |
function | (self) -> Any |
(shared captured text) |
alignmentRect |
function | (self, arg__1: Any) -> Any |
X.alignmentRect(arg__1) -> PythonQt.QtCore.QRect (shared captured text) |
blockSignals |
function | (self, b: Any) -> bool |
X.blockSignals(b) -> bool (shared captured text) |
childEvent |
function | (self, e: Any) -> Any |
(shared captured text) |
children |
function | (self) -> tuple |
X.children() -> tuple (shared captured text) |
className |
function | (self, *args: Any, **kwargs: Any) -> Any |
Return the classname of the object (shared captured text) |
closestAcceptableSize |
function | (self, w: Any, s: Any) -> Any |
X.closestAcceptableSize(w, s) -> PythonQt.QtCore.QSize (shared captured text) |
connect |
function | (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool |
X.connect(signal, receiver, slot, type) -> bool (shared captured text) |
contentsMargins |
function | (self) -> Any |
X.contentsMargins() -> PythonQt.QtGui.QMargins (shared captured text) |
contentsRect |
function | (self) -> Any |
X.contentsRect() -> PythonQt.QtCore.QRect (shared captured text) |
controlTypes |
function | (self) -> Any |
(shared captured text) |
count |
function | (self) -> int |
X.count() -> int (shared captured text) |
customEvent |
function | (self, event: Any) -> Any |
(shared captured text) |
delete |
function | (self, *args: Any, **kwargs: Any) -> Any |
Deletes the C++ object (at your own risk, my friend!) (shared captured text) |
deleteLater |
function | (self) -> Any |
(shared captured text) |
destroyed |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QBoxLayout.destroyed; argument details are not documented. |
direction |
function | (self) -> Any |
Returns the direction of the box. (shared captured text) |
disconnect |
function | (self, signal: Any, receiver: Any, slot: Any) -> bool |
X.disconnect(signal, receiver, slot) -> bool (shared captured text) |
dumpObjectInfo |
function | (self) -> Any |
(shared captured text) |
dumpObjectTree |
function | (self) -> Any |
(shared captured text) |
dynamicPropertyNames |
function | (self) -> Any |
(shared captured text) |
event |
function | (self, event: Any) -> bool |
X.event(event) -> bool (shared captured text) |
eventFilter |
function | (self, watched: Any, event: Any) -> bool |
X.eventFilter(watched, event) -> bool (shared captured text) |
expandingDirections |
function | (self) -> Any |
Reimplements: [QLayout::expandingDirections](https://doc.qt.io/archives/qt-5.15/qlayout.html#expandingDirections)() const. (shared captured text) |
findChild |
function | (self, type: Any, name: Any) -> Any |
X.findChild(type, name) -> PythonQt.private.QObject (shared captured text) |
findChildren |
function | (self, type: Any, name: Any) -> tuple |
X.findChildren(type, name) -> tuple (shared captured text) |
geometry |
function | (self) -> Any |
X.geometry() -> PythonQt.QtCore.QRect (shared captured text) |
hasHeightForWidth |
function | (self) -> bool |
X.hasHeightForWidth() -> bool (shared captured text) |
heightForWidth |
function | (self, arg__1: int) -> int |
X.heightForWidth(arg__1) -> int (shared captured text) |
help |
function | (self, *args: Any, **kwargs: Any) -> Any |
Shows the help of available methods for this class (shared captured text) |
indexOf |
function | (self, arg__1: Any) -> int |
X.indexOf(arg__1) -> int (shared captured text) |
inherits |
function | (self, *args: Any, **kwargs: Any) -> Any |
Returns if the class inherits or is of given type name (shared captured text) |
insertItem |
function | (self, index: int, arg__2: Any) -> None |
X.insertItem(index, arg__2) (shared captured text) |
insertLayout |
function | (self, index: int, layout: Any, stretch: int) -> None |
X.insertLayout(index, layout, stretch) (shared captured text) |
insertSpacerItem |
function | (self, index: int, spacerItem: Any) -> None |
X.insertSpacerItem(index, spacerItem) (shared captured text) |
insertSpacing |
function | (self, index: int, size: int) -> None |
X.insertSpacing(index, size) (shared captured text) |
insertStretch |
function | (self, index: int, stretch: int) -> None |
X.insertStretch(index, stretch) (shared captured text) |
insertWidget |
function | (self, index: int, widget: Any, stretch: int, alignment: Any) -> None |
X.insertWidget(index, widget, stretch, alignment) (shared captured text) |
installEventFilter |
function | (self, filterObj: Any) -> Any |
(shared captured text) |
invalidate |
function | (self) -> None |
Reimplements: [QLayout::invalidate](https://doc.qt.io/archives/qt-5.15/qlayout.html#invalidate)(). (shared captured text) |
isEmpty |
function | (self) -> bool |
X.isEmpty() -> bool (shared captured text) |
isEnabled |
function | (self) -> bool |
X.isEnabled() -> bool (shared captured text) |
isSignalConnected |
function | (self, signal: Any) -> bool |
X.isSignalConnected(signal) -> bool (shared captured text) |
isWidgetType |
function | (self) -> bool |
X.isWidgetType() -> bool (shared captured text) |
isWindowType |
function | (self) -> bool |
X.isWindowType() -> bool (shared captured text) |
itemAt |
function | (self, arg__1: int) -> Any |
X.itemAt(arg__1) -> PythonQt.QtGui.QLayoutItem (shared captured text) |
killTimer |
function | (self, id: Any) -> Any |
(shared captured text) |
layout |
function | (self) -> Any |
X.layout() -> PythonQt.QtGui.QLayout (shared captured text) |
margin |
attribute | Any |
(shared captured text) |
maximumSize |
function | (self) -> Any |
X.maximumSize() -> PythonQt.QtCore.QSize (shared captured text) |
menuBar |
function | (self) -> Any |
X.menuBar() -> PythonQt.QtGui.QWidget (shared captured text) |
metaObject |
function | (self) -> Any |
X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text) |
minimumHeightForWidth |
function | (self, arg__1: int) -> int |
X.minimumHeightForWidth(arg__1) -> int (shared captured text) |
minimumSize |
function | (self) -> Any |
X.minimumSize() -> PythonQt.QtCore.QSize (shared captured text) |
moveToThread |
function | (self, thread: Any) -> Any |
(shared captured text) |
objectName |
attribute | Any |
(shared captured text) |
objectNameChanged |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QBoxLayout.objectNameChanged; argument details are not documented. |
parent |
function | (self) -> Any |
X.parent() -> PythonQt.private.QObject (shared captured text) |
parentWidget |
function | (self) -> Any |
X.parentWidget() -> PythonQt.QtGui.QWidget (shared captured text) |
property |
function | (self, name: Any) -> Any |
X.property(name) -> object (shared captured text) |
removeEventFilter |
function | (self, obj: Any) -> Any |
(shared captured text) |
removeItem |
function | (self, arg__1: Any) -> Any |
(shared captured text) |
removeWidget |
function | (self, w: Any) -> Any |
(shared captured text) |
replaceWidget |
function | (self, *args: Any, **kwargs: Any) -> Any |
X.replaceWidget(from, to, options) -> PythonQt.QtGui.QLayoutItem (shared captured text) |
sender |
function | (self) -> Any |
X.sender() -> PythonQt.private.QObject (shared captured text) |
senderSignalIndex |
function | (self) -> int |
X.senderSignalIndex() -> int (shared captured text) |
setAlignment |
function | (self, l: Any, alignment: Any) -> bool |
X.setAlignment(l, alignment) -> bool (shared captured text) |
setContentsMargins |
function | (self, left: Any, top: Any, right: Any, bottom: Any) -> Any |
X.setContentsMargins(left, top, right, bottom) (shared captured text) |
setDirection |
function | (self, arg__1: Any) -> None |
Sets the direction of this layout to direction. (shared captured text) |
setEnabled |
function | (self, arg__1: Any) -> Any |
(shared captured text) |
setGeometry |
function | (self, arg__1: Any) -> None |
Reimplements: [QLayout::setGeometry](https://doc.qt.io/archives/qt-5.15/qlayout.html#setGeometry)(const QRect \&r). (shared captured text) |
setMargin |
function | (self, arg__1: Any) -> Any |
(shared captured text) |
setMenuBar |
function | (self, w: Any) -> Any |
(shared captured text) |
setObjectName |
function | (self, name: Any) -> Any |
(shared captured text) |
setParent |
function | (self, parent: Any) -> Any |
(shared captured text) |
setProperty |
function | (self, name: Any, value: Any) -> bool |
X.setProperty(name, value) -> bool (shared captured text) |
setSizeConstraint |
function | (self, arg__1: Any) -> Any |
(shared captured text) |
setSpacing |
function | (self, spacing: int) -> None |
Reimplements [QLayout::setSpacing](https://doc.qt.io/archives/qt-5.15/qlayout.html#spacing-prop)(). (shared captured text) |
setStretch |
function | (self, index: int, stretch: int) -> None |
X.setStretch(index, stretch) (shared captured text) |
setStretchFactor |
function | (self, l: Any, stretch: int) -> bool |
X.setStretchFactor(l, stretch) -> bool (shared captured text) |
signalsBlocked |
function | (self) -> bool |
X.signalsBlocked() -> bool (shared captured text) |
sizeConstraint |
attribute | Any |
(shared captured text) |
sizeHint |
function | (self) -> Any |
X.sizeHint() -> PythonQt.QtCore.QSize (shared captured text) |
spacerItem |
function | (self) -> Any |
X.spacerItem() -> PythonQt.QtGui.QSpacerItem (shared captured text) |
spacing |
attribute | int |
Reimplements [QLayout::spacing](https://doc.qt.io/archives/qt-5.15/qlayout.html#spacing-prop)(). (shared captured text) |
startTimer |
function | (self, interval: Any, timerType: Any) -> int |
X.startTimer(interval, timerType) -> int (shared captured text) |
stretch |
function | (self, index: int) -> int |
X.stretch(index) -> int (shared captured text) |
takeAt |
function | (self, arg__1: int) -> Any |
X.takeAt(arg__1) -> PythonQt.QtGui.QLayoutItem (shared captured text) |
thread |
function | (self) -> Any |
(shared captured text) |
timerEvent |
function | (self, event: Any) -> Any |
(shared captured text) |
totalHeightForWidth |
function | (self, w: Any) -> int |
X.totalHeightForWidth(w) -> int (shared captured text) |
totalMaximumSize |
function | (self) -> Any |
X.totalMaximumSize() -> PythonQt.QtCore.QSize (shared captured text) |
totalMinimumSize |
function | (self) -> Any |
X.totalMinimumSize() -> PythonQt.QtCore.QSize (shared captured text) |
totalSizeHint |
function | (self) -> Any |
X.totalSizeHint() -> PythonQt.QtCore.QSize (shared captured text) |
tr |
function | (self, text: Any, ambig: Any, n: Any) -> str |
X.tr(text, ambig, n) -> str (shared captured text) |
update |
function | (self) -> Any |
(shared captured text) |
widget |
function | (self) -> Any |
X.widget() -> PythonQt.QtGui.QWidget (shared captured text) |
widgetEvent |
function | (self, arg__1: Any) -> Any |
(shared captured text) |