Skip to content

PythonQt.QtGui.QLayout · declarations 001

Back to PythonQt.QtGui.QLayout

activate

activate() -> bool

X.activate() -> bool

Supplemental documentation: Qt 5 reference:

bool QLayout::activate()

Redoes the layout for parentWidget() if necessary.

You should generally not need to call this because it is automatically called at the most appropriate times. It returns true if the layout was redone.

See also update() and QWidget::updateGeometry().

Upstream PySide2 reference signatures (binding differences may apply):

activate(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#activate

addChildLayout

addChildLayout(l: Any) -> None

X.addChildLayout(l)

Supplemental documentation: Qt 5 reference:

[protected] void QLayout::addChildLayout(QLayout *l)

This function is called from addLayout() or insertLayout() functions in subclasses to add layout l as a sub-layout.

The only scenario in which you need to call it directly is if you implement a custom layout that supports nested layouts.

See also QBoxLayout::addLayout(), QBoxLayout::insertLayout(), and QGridLayout::addLayout().

Upstream PySide2 reference signatures (binding differences may apply):

addChildLayout(self, l: PySide2.QtWidgets.QLayout) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#addChildLayout

addChildWidget

addChildWidget(w: Any) -> None

X.addChildWidget(w)

Supplemental documentation: Qt 5 reference:

[protected] void QLayout::addChildWidget(QWidget *w)

This function is called from addWidget() functions in subclasses to add w as a managed widget of a layout.

If w is already managed by a layout, this function will give a warning and remove w from that layout. This function must therefore be called before adding w to the layout's data structure.

Upstream PySide2 reference signatures (binding differences may apply):

addChildWidget(self, w: PySide2.QtWidgets.QWidget) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#addChildWidget

addItem

addItem(arg__1: Any) -> None

X.addItem(arg__1)

Supplemental documentation: Qt 5 reference:

[pure virtual] void QLayout::addItem(QLayoutItem *item)

Implemented in subclasses to add an item. How it is added is specific to each subclass.

This function is not usually called in application code. To add a widget to a layout, use the addWidget() function; to add a child layout, use the addLayout() function provided by the relevant QLayout subclass.

Note: The ownership of item is transferred to the layout, and it's the layout's responsibility to delete it.

See also addWidget(), QBoxLayout::addLayout(), and QGridLayout::addLayout().

Upstream PySide2 reference signatures (binding differences may apply):

addItem(self, arg__1: PySide2.QtWidgets.QLayoutItem) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#addItem

addWidget

addWidget(w: Any) -> None

X.addWidget(w)

Supplemental documentation: Qt 5 reference:

void QLayout::addWidget(QWidget *w)

Adds widget w to this layout in a manner specific to the layout. This function uses addItem().

Upstream PySide2 reference signatures (binding differences may apply):

addWidget(self, w: PySide2.QtWidgets.QWidget) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#addWidget

adoptLayout

adoptLayout(layout: Any) -> bool

X.adoptLayout(layout) -> bool

Upstream PySide2 reference signatures (binding differences may apply):

adoptLayout(self, layout: PySide2.QtWidgets.QLayout) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#adoptLayout

alignmentRect

alignmentRect(arg__1: Any) -> Any

X.alignmentRect(arg__1) -> PythonQt.QtCore.QRect

Supplemental documentation: Qt 5 reference:

[protected] QRect QLayout::alignmentRect(const QRect \&r) const

Returns the rectangle that should be covered when the geometry of this layout is set to r, provided that this layout supports setAlignment().

The result is derived from sizeHint() and expanding(). It is never larger than r.

Upstream PySide2 reference signatures (binding differences may apply):

alignmentRect(self, arg__1: PySide2.QtCore.QRect) -> PySide2.QtCore.QRect

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#alignmentRect

childEvent

childEvent(e: Any) -> None

X.childEvent(e)

Supplemental documentation: Qt 5 reference:

[override virtual protected] void QLayout::childEvent(QChildEvent *e)

Reimplements: QObject::childEvent(QChildEvent *event).

Upstream PySide2 reference signatures (binding differences may apply):

childEvent(self, e: PySide2.QtCore.QChildEvent) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#childEvent

closestAcceptableSize

closestAcceptableSize(w: Any, s: Any) -> Any

X.closestAcceptableSize(w, s) -> PythonQt.QtCore.QSize

Supplemental documentation: Qt 5 reference:

[static] QSize QLayout::closestAcceptableSize(const QWidget *widget, const QSize \&size)

Returns a size that satisfies all size constraints on widget, including heightForWidth() and that is as close as possible to size.

Upstream PySide2 reference signatures (binding differences may apply):

closestAcceptableSize(w: PySide2.QtWidgets.QWidget, s: PySide2.QtCore.QSize) -> PySide2.QtCore.QSize

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#closestAcceptableSize

contentsMargins

contentsMargins() -> Any

X.contentsMargins() -> PythonQt.QtGui.QMargins

Supplemental documentation: Qt 5 reference:

QMargins QLayout::contentsMargins() const

Returns the margins used around the layout.

By default, QLayout uses the values provided by the style. On most platforms, the margin is 11 pixels in all directions.

This function was introduced in Qt 4.6.

See also setContentsMargins().

Upstream PySide2 reference signatures (binding differences may apply):

contentsMargins(self) -> PySide2.QtCore.QMargins

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#contentsMargins

contentsRect

contentsRect() -> Any

X.contentsRect() -> PythonQt.QtCore.QRect

Supplemental documentation: Qt 5 reference:

QRect QLayout::contentsRect() const

Returns the layout's geometry() rectangle, but taking into account the contents margins.

This function was introduced in Qt 4.3.

See also setContentsMargins() and getContentsMargins().

Upstream PySide2 reference signatures (binding differences may apply):

contentsRect(self) -> PySide2.QtCore.QRect

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#contentsRect

controlTypes

controlTypes() -> Any

X.controlTypes()

Supplemental documentation: Qt 5 reference:

[override virtual] QSizePolicy::ControlTypes QLayout::controlTypes() const

Reimplements: QLayoutItem::controlTypes() const.

Upstream PySide2 reference signatures (binding differences may apply):

controlTypes(self) -> PySide2.QtWidgets.QSizePolicy.ControlTypes

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#controlTypes

count

count() -> int

X.count() -> int

Supplemental documentation: Qt 5 reference:

[pure virtual] int QLayout::count() const

Must be implemented in subclasses to return the number of items in the layout.

See also itemAt().

Upstream PySide2 reference signatures (binding differences may apply):

count(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#count

destroyed

destroyed(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QLayout.destroyed; argument details are not documented.

expandingDirections

expandingDirections() -> Any

X.expandingDirections()

Supplemental documentation: Qt 5 reference:

[override virtual] Qt::Orientations QLayout::expandingDirections() const

Reimplements: QLayoutItem::expandingDirections() const.

Returns whether this layout can make use of more space than sizeHint(). A value of Qt::Vertical or Qt::Horizontal means that it wants to grow in only one dimension, whereas Qt::Vertical | Qt::Horizontal means that it wants to grow in both dimensions.

The default implementation returns Qt::Horizontal | Qt::Vertical. Subclasses reimplement it to return a meaningful value based on their child widgets's size policies.

See also sizeHint().

Upstream PySide2 reference signatures (binding differences may apply):

expandingDirections(self) -> PySide2.QtCore.Qt.Orientations

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#expandingDirections

geometry

geometry() -> Any

X.geometry() -> PythonQt.QtCore.QRect

Supplemental documentation: Qt 5 reference:

[override virtual] QRect QLayout::geometry() const

Reimplements: QLayoutItem::geometry() const.

See also setGeometry().

Upstream PySide2 reference signatures (binding differences may apply):

geometry(self) -> PySide2.QtCore.QRect

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#geometry

indexOf

indexOf(arg__1: Any) -> int

X.indexOf(arg__1) -> int

Supplemental documentation: Qt 5 reference:

[virtual] int QLayout::indexOf(QWidget *widget) const

Searches for widget widget in this layout (not including child layouts).

Returns the index of widget, or -1 if widget is not found.

The default implementation iterates over all items using itemAt()

int QLayout::indexOf(QLayoutItem *layoutItem) const

Searches for layout item layoutItem in this layout (not including child layouts).

Returns the index of layoutItem, or -1 if layoutItem is not found.

This function was introduced in Qt 5.12.

Upstream PySide2 reference signatures (binding differences may apply):

indexOf(self, arg__1: PySide2.QtWidgets.QLayoutItem) -> int
indexOf(self, arg__1: PySide2.QtWidgets.QWidget) -> int

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#indexOf

invalidate

invalidate() -> None

X.invalidate()

Supplemental documentation: Qt 5 reference:

[override virtual] void QLayout::invalidate()

Reimplements: QLayoutItem::invalidate().

Upstream PySide2 reference signatures (binding differences may apply):

invalidate(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#invalidate

isEmpty

isEmpty() -> bool

X.isEmpty() -> bool

Supplemental documentation: Qt 5 reference:

[override virtual] bool QLayout::isEmpty() const

Reimplements: QLayoutItem::isEmpty() const.

Upstream PySide2 reference signatures (binding differences may apply):

isEmpty(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#isEmpty

isEnabled

isEnabled() -> bool

X.isEnabled() -> bool

Supplemental documentation: Qt 5 reference:

bool QLayout::isEnabled() const

Returns true if the layout is enabled; otherwise returns false.

See also setEnabled().

Upstream PySide2 reference signatures (binding differences may apply):

isEnabled(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#isEnabled

itemAt

itemAt(index: int) -> Any

X.itemAt(index) -> PythonQt.QtGui.QLayoutItem

Supplemental documentation: Qt 5 reference:

[pure virtual] QLayoutItem *QLayout::itemAt(int index) const

Must be implemented in subclasses to return the layout item at index. If there is no such item, the function must return 0. Items are numbered consecutively from 0. If an item is deleted, other items will be renumbered.

This function can be used to iterate over a layout. The following code will draw a rectangle for each layout item in the layout structure of the widget.

static void paintLayout(QPainter *painter, QLayoutItem *item)
{
    QLayout *layout = item->layout();
    if (layout) {
        for (int i = 0; i < layout->count(); ++i)
            paintLayout(painter, layout->itemAt(i));
    }
    painter->drawRect(item->geometry());
}

void MyWidget::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    if (layout())
        paintLayout(&painter, layout());
}

See also count() and takeAt().

Upstream PySide2 reference signatures (binding differences may apply):

itemAt(self, index: int) -> PySide2.QtWidgets.QLayoutItem

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#itemAt

layout

layout() -> Any

X.layout() -> PythonQt.QtGui.QLayout

Supplemental documentation: Qt 5 reference:

[override virtual] QLayout *QLayout::layout()

Reimplements: QLayoutItem::layout().

Upstream PySide2 reference signatures (binding differences may apply):

layout(self) -> PySide2.QtWidgets.QLayout

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#layout

margin instance-attribute

margin: int

maximumSize

maximumSize() -> Any

X.maximumSize() -> PythonQt.QtCore.QSize

Supplemental documentation: Qt 5 reference:

[override virtual] QSize QLayout::maximumSize() const

Reimplements: QLayoutItem::maximumSize() const.

Returns the maximum size of this layout. This is the largest size that the layout can have while still respecting the specifications.

The returned value doesn't include the space required by QWidget::setContentsMargins() or menuBar().

The default implementation allows unlimited resizing.

Upstream PySide2 reference signatures (binding differences may apply):

maximumSize(self) -> PySide2.QtCore.QSize

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#maximumSize

menuBar

menuBar() -> Any

X.menuBar() -> PythonQt.QtGui.QWidget

Supplemental documentation: Qt 5 reference:

QWidget *QLayout::menuBar() const

Returns the menu bar set for this layout, or nullptr if no menu bar is set.

See also setMenuBar().

Upstream PySide2 reference signatures (binding differences may apply):

menuBar(self) -> PySide2.QtWidgets.QWidget

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#menuBar

minimumSize

minimumSize() -> Any

X.minimumSize() -> PythonQt.QtCore.QSize

Supplemental documentation: Qt 5 reference:

[override virtual] QSize QLayout::minimumSize() const

Reimplements: QLayoutItem::minimumSize() const.

Returns the minimum size of this layout. This is the smallest size that the layout can have while still respecting the specifications.

The returned value doesn't include the space required by QWidget::setContentsMargins() or menuBar().

The default implementation allows unlimited resizing.

Upstream PySide2 reference signatures (binding differences may apply):

minimumSize(self) -> PySide2.QtCore.QSize

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#minimumSize

objectNameChanged

objectNameChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtGui.QLayout.objectNameChanged; argument details are not documented.

parentWidget

parentWidget() -> Any

X.parentWidget() -> PythonQt.QtGui.QWidget

Supplemental documentation: Qt 5 reference:

QWidget *QLayout::parentWidget() const

Returns the parent widget of this layout, or nullptr if this layout is not installed on any widget.

If the layout is a sub-layout, this function returns the parent widget of the parent layout.

See also parent().

Upstream PySide2 reference signatures (binding differences may apply):

parentWidget(self) -> PySide2.QtWidgets.QWidget

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#parentWidget

removeItem

removeItem(arg__1: Any) -> None

X.removeItem(arg__1)

Supplemental documentation: Qt 5 reference:

void QLayout::removeItem(QLayoutItem *item)

Removes the layout item item from the layout. It is the caller's responsibility to delete the item.

Notice that item can be a layout (since QLayout inherits QLayoutItem).

See also removeWidget() and addItem().

Upstream PySide2 reference signatures (binding differences may apply):

removeItem(self, arg__1: PySide2.QtWidgets.QLayoutItem) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#removeItem

removeWidget

removeWidget(w: Any) -> None

X.removeWidget(w)

Supplemental documentation: Qt 5 reference:

void QLayout::removeWidget(QWidget *widget)

Removes the widget widget from the layout. After this call, it is the caller's responsibility to give the widget a reasonable geometry or to put the widget back into a layout or to explicitly hide it if necessary.

Note: The ownership of widget remains the same as when it was added.

See also removeItem(), QWidget::setGeometry(), and addWidget().

Upstream PySide2 reference signatures (binding differences may apply):

removeWidget(self, w: PySide2.QtWidgets.QWidget) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#removeWidget

replaceWidget

replaceWidget(*args: Any, **kwargs: Any) -> Any

X.replaceWidget(from, to, options) -> PythonQt.QtGui.QLayoutItem

Supplemental documentation: Qt 5 reference:

QLayoutItem *QLayout::replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOptions options \= Qt::FindChildrenRecursively)

Searches for widget from and replaces it with widget to if found. Returns the layout item that contains the widget from on success. Otherwise nullptr is returned. If options contains Qt::FindChildrenRecursively (the default), sub-layouts are searched for doing the replacement. Any other flag in options is ignored.

Notice that the returned item therefore might not belong to this layout, but to a sub-layout.

The returned layout item is no longer owned by the layout and should be either deleted or inserted to another layout. The widget from is no longer managed by the layout and may need to be deleted or hidden. The parent of widget from is left unchanged.

This function works for the built-in Qt layouts, but might not work for custom layouts.

This function was introduced in Qt 5.2.

See also indexOf().

Upstream PySide2 reference signatures (binding differences may apply):

replaceWidget(self, from_: PySide2.QtWidgets.QWidget, to: PySide2.QtWidgets.QWidget, options: PySide2.QtCore.Qt.FindChildOptions=...) -> PySide2.QtWidgets.QLayoutItem

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#replaceWidget

setAlignment

setAlignment(l: Any, alignment: Any) -> bool

X.setAlignment(l, alignment) -> bool

Supplemental documentation: Qt 5 reference:

bool QLayout::setAlignment(QWidget *w, Qt::Alignment alignment)

Sets the alignment for widget w to alignment and returns true if w is found in this layout (not including child layouts); otherwise returns false.

bool QLayout::setAlignment(QLayout *l, Qt::Alignment alignment)

This is an overloaded function.

Sets the alignment for the layout l to alignment and returns true if l is found in this layout (not including child layouts); otherwise returns false.

Upstream PySide2 reference signatures (binding differences may apply):

setAlignment(self, arg__1: PySide2.QtCore.Qt.Alignment) -> None
setAlignment(self, l: PySide2.QtWidgets.QLayout, alignment: PySide2.QtCore.Qt.Alignment) -> bool
setAlignment(self, w: PySide2.QtWidgets.QWidget, alignment: PySide2.QtCore.Qt.Alignment) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#setAlignment

setContentsMargins

setContentsMargins(left: Any, top: Any, right: Any, bottom: Any) -> None

X.setContentsMargins(left, top, right, bottom)

Supplemental documentation: Qt 5 reference:

void QLayout::setContentsMargins(int left, int top, int right, int bottom)

Sets the left, top, right, and bottom margins to use around the layout.

By default, QLayout uses the values provided by the style. On most platforms, the margin is 11 pixels in all directions.

This function was introduced in Qt 4.3.

See also contentsMargins(), getContentsMargins(), QStyle::pixelMetric(), PM_LayoutLeftMargin, PM_LayoutTopMargin, PM_LayoutRightMargin, and PM_LayoutBottomMargin.

void QLayout::setContentsMargins(const QMargins \&margins)

Sets the margins to use around the layout.

By default, QLayout uses the values provided by the style. On most platforms, the margin is 11 pixels in all directions.

This function was introduced in Qt 4.6.

See also contentsMargins().

Upstream PySide2 reference signatures (binding differences may apply):

setContentsMargins(self, left: int, top: int, right: int, bottom: int) -> None
setContentsMargins(self, margins: PySide2.QtCore.QMargins) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#setContentsMargins

setEnabled

setEnabled(arg__1: bool) -> None

X.setEnabled(arg__1)

Supplemental documentation: Qt 5 reference:

void QLayout::setEnabled(bool enable)

Enables this layout if enable is true, otherwise disables it.

An enabled layout adjusts dynamically to changes; a disabled layout acts as if it did not exist.

By default all layouts are enabled.

See also isEnabled().

Upstream PySide2 reference signatures (binding differences may apply):

setEnabled(self, arg__1: bool) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#setEnabled

setGeometry

setGeometry(arg__1: Any) -> None

X.setGeometry(arg__1)

Supplemental documentation: Qt 5 reference:

[override virtual] void QLayout::setGeometry(const QRect \&r)

Reimplements: QLayoutItem::setGeometry(const QRect \&r).

See also geometry().

Upstream PySide2 reference signatures (binding differences may apply):

setGeometry(self, arg__1: PySide2.QtCore.QRect) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#setGeometry

setMargin

setMargin(arg__1: int) -> None

X.setMargin(arg__1)

Upstream PySide2 reference signatures (binding differences may apply):

setMargin(self, arg__1: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#setMargin

setMenuBar

setMenuBar(w: Any) -> None

X.setMenuBar(w)

Supplemental documentation: Qt 5 reference:

void QLayout::setMenuBar(QWidget *widget)

Tells the geometry manager to place the menu bar widget at the top of parentWidget(), outside QWidget::contentsMargins(). All child widgets are placed below the bottom edge of the menu bar.

See also menuBar().

Upstream PySide2 reference signatures (binding differences may apply):

setMenuBar(self, w: PySide2.QtWidgets.QWidget) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#setMenuBar

setSizeConstraint

setSizeConstraint(arg__1: Any) -> None

X.setSizeConstraint(arg__1)

Upstream PySide2 reference signatures (binding differences may apply):

setSizeConstraint(self, arg__1: PySide2.QtWidgets.QLayout.SizeConstraint) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#setSizeConstraint

setSpacing

setSpacing(arg__1: int) -> None

X.setSpacing(arg__1)

Upstream PySide2 reference signatures (binding differences may apply):

setSpacing(self, arg__1: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#setSpacing

sizeConstraint instance-attribute

sizeConstraint: Any

Qt 5 reference:

sizeConstraint : SizeConstraint

This property holds the resize mode of the layout

The default mode is SetDefaultConstraint.

Access functions:

QLayout::SizeConstraint sizeConstraint() const
void setSizeConstraint(QLayout::SizeConstraint)

Source: https://doc.qt.io/archives/qt-5.15/qlayout.html#sizeConstraint