Qt 4.3: QSpacerItem Class Reference

|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# QSpacerItem Class Reference
[QtGui module]

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

     #include <QSpacerItem>

Inherits QLayoutItem.

- List of all members, including inherited members

### Public Functions

- QSpacerItem ( int w, int h, QSizePolicy::Policy hPolicy = QSizePolicy::Minimum, QSizePolicy::Policy vPolicy = QSizePolicy::Minimum )
- void changeSize ( int w, int h, QSizePolicy::Policy hPolicy = QSizePolicy::Minimum, QSizePolicy::Policy vPolicy = QSizePolicy::Minimum )
- virtual bool isEmpty () const
- virtual QSpacerItem * spacerItem ()

- 17 public functions inherited from QLayoutItem

## 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()

See also QLayout, QWidgetItem, and QLayoutItem::spacerItem().

## Member Function Documentation

### QSpacerItem::QSpacerItem ( 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.

### void QSpacerItem::changeSize ( 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().

### bool QSpacerItem::isEmpty () const `[virtual]`

Returns true.

Reimplemented from QLayoutItem.

### QSpacerItem * QSpacerItem::spacerItem () `[virtual]`

Returns a pointer to this object.

Reimplemented from QLayoutItem.