|  | Home · All Classes · Modules

# QSpacerItem Class Reference
[QtGui module]

The QSpacerItem class provides blank space in a layout. More...

Inherits QLayoutItem.

### Methods

- __init__ (self, int w, int h, QSizePolicy.Policy hPolicy = QSizePolicy.Minimum, QSizePolicy.Policy vPolicy = QSizePolicy.Minimum)
- __init__ (self, QSpacerItem)
- changeSize (self, int w, int h, QSizePolicy.Policy hPolicy = QSizePolicy.Minimum, QSizePolicy.Policy vPolicy = QSizePolicy.Minimum)
- Qt.Orientations expandingDirections (self)
- QRect geometry (self)
- bool isEmpty (self)
- QSize maximumSize (self)
- QSize minimumSize (self)
- setGeometry (self, QRect)
- QSize sizeHint (self)
- QSpacerItem spacerItem (self)

## Detailed Description

The QSpacerItem class provides blank space in a layout.

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 | Functions
--- | ---
QHBoxLayout | addSpacing(), addStretch(), insertSpacing(), insertStretch()
QGridLayout | setRowMinimumHeight(), setRowStretch(), setColumnMinimumWidth(), setColumnStretch()

## Method Documentation

### QSpacerItem.__init__ (self, int w, int h, QSizePolicy.Policy hPolicy = QSizePolicy.Minimum, QSizePolicy.Policy vPolicy = QSizePolicy.Minimum)

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.

### QSpacerItem.__init__ (self, QSpacerItem)

### QSpacerItem.changeSize (self, int w, int h, QSizePolicy.Policy hPolicy = QSizePolicy.Minimum, QSizePolicy.Policy vPolicy = QSizePolicy.Minimum)

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 QSpacerItem.invalidate().

### Qt.Orientations QSpacerItem.expandingDirections (self)

Reimplemented from QLayoutItem.expandingDirections().

### QRect QSpacerItem.geometry (self)

Reimplemented from QLayoutItem.geometry().

See also setGeometry().

### bool QSpacerItem.isEmpty (self)

Reimplemented from QLayoutItem.isEmpty().

Returns true.

### QSize QSpacerItem.maximumSize (self)

Reimplemented from QLayoutItem.maximumSize().

### QSize QSpacerItem.minimumSize (self)

Reimplemented from QLayoutItem.minimumSize().

### QSpacerItem.setGeometry (self, QRect)

Reimplemented from QLayoutItem.setGeometry().

See also geometry().

### QSize QSpacerItem.sizeHint (self)

Reimplemented from QLayoutItem.sizeHint().

### QSpacerItem QSpacerItem.spacerItem (self)

Reimplemented from QLayoutItem.spacerItem().

Returns a pointer to this object.