QSpacerItem#

The QSpacerItem class provides blank space in a layout. More

Inheritance diagram of PySide6.QtWidgets.QSpacerItem

Synopsis#

Functions#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

Normally, you don’t need to use this class directly. Qt’s built-in layout managers provide the following functions for manipulating empty space in layouts:

class PySide6.QtWidgets.QSpacerItem(w, h[, hData=QSizePolicy.Minimum[, vData=QSizePolicy.Minimum]])#
Parameters:

Constructs a spacer item with preferred width w, preferred height h, horizontal size policy hPolicy and vertical size policy vPolicy.

The default values provide a gap that is able to stretch if nothing else wants the space.

PySide6.QtWidgets.QSpacerItem.changeSize(w, h[, hData=QSizePolicy.Minimum[, vData=QSizePolicy.Minimum]])#
Parameters:

Changes this spacer item to have preferred width w, preferred height h, horizontal size policy hPolicy and vertical size policy vPolicy.

The default values provide a gap that is able to stretch if nothing else wants the space.

Note that if changeSize() is called after the spacer item has been added to a layout, it is necessary to invalidate the layout in order for the spacer item’s new size to take effect.

See also

invalidate()

PySide6.QtWidgets.QSpacerItem.sizePolicy()#
Return type:

PySide6.QtWidgets.QSizePolicy

Returns the size policy of this item.