Skip to content

PythonQt.Qt.QHBoxLayout

QHBoxLayout

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

This class is used to construct horizontal box layout objects. See QBoxLayout for details.

The simplest use of the class is like this:

    QWidget *window = new QWidget;
    QPushButton *button1 = new QPushButton("One");
    QPushButton *button2 = new QPushButton("Two");
    QPushButton *button3 = new QPushButton("Three");
    QPushButton *button4 = new QPushButton("Four");
    QPushButton *button5 = new QPushButton("Five");

    QHBoxLayout *layout = new QHBoxLayout(window);
    layout->addWidget(button1);
    layout->addWidget(button2);
    layout->addWidget(button3);
    layout->addWidget(button4);
    layout->addWidget(button5);

    window->show();

First, we create the widgets we want to add to the layout. Then, we create the QHBoxLayout object, setting window as parent by passing it in the constructor; next we add the widgets to the layout. window will be the parent of the widgets that are added to the layout.

If you don't pass a parent window to the constructor, you can at a later point use QWidget::setLayout() to install the QHBoxLayout object onto window. At that point, the widgets in the layout are reparented to have window as their parent.

Horizontal box layout with five child
widgets

Source: https://doc.qt.io/archives/qt-5.15/qhboxlayout.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) -> Any (shared captured text)
addLayout function (self, layout: Any, stretch: Any) -> Any X.addLayout(layout, stretch) (shared captured text)
addSpacerItem function (self, spacerItem: Any) -> Any (shared captured text)
addSpacing function (self, size: Any) -> Any (shared captured text)
addStretch function (self, stretch: Any) -> Any (shared captured text)
addStrut function (self, arg__1: Any) -> Any (shared captured text)
addWidget function (self, arg__1: Any, stretch: Any, alignment: Any) -> Any 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.QHBoxLayout.destroyed; argument details are not documented.
direction function (self) -> Any (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 (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: Any) -> 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: Any, arg__2: Any) -> Any X.insertItem(index, arg__2) (shared captured text)
insertLayout function (self, index: Any, layout: Any, stretch: Any) -> Any X.insertLayout(index, layout, stretch) (shared captured text)
insertSpacerItem function (self, index: Any, spacerItem: Any) -> Any X.insertSpacerItem(index, spacerItem) (shared captured text)
insertSpacing function (self, index: Any, size: Any) -> Any X.insertSpacing(index, size) (shared captured text)
insertStretch function (self, index: Any, stretch: Any) -> Any X.insertStretch(index, stretch) (shared captured text)
insertWidget function (self, index: Any, widget: Any, stretch: Any, alignment: Any) -> Any X.insertWidget(index, widget, stretch, alignment) (shared captured text)
installEventFilter function (self, filterObj: Any) -> Any (shared captured text)
invalidate function (self) -> Any (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: Any) -> 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: Any) -> 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.QHBoxLayout.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) -> Any (shared captured text)
setEnabled function (self, arg__1: Any) -> Any (shared captured text)
setGeometry function (self, arg__1: Any) -> Any (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: Any) -> Any (shared captured text)
setStretch function (self, index: Any, stretch: Any) -> Any X.setStretch(index, stretch) (shared captured text)
setStretchFactor function (self, l: Any, stretch: Any) -> 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 Any (shared captured text)
startTimer function (self, interval: Any, timerType: Any) -> int X.startTimer(interval, timerType) -> int (shared captured text)
stretch function (self, index: Any) -> int X.stretch(index) -> int (shared captured text)
takeAt function (self, arg__1: Any) -> 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)