QSpacerItem Class

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

Header: #include <QSpacerItem>
qmake: QT += widgets
Inherits: QLayoutItem.

Public Functions

QSpacerItem(int w, int h, QSizePolicy::Policy hPolicy = QSizePolicy::Minimum, QSizePolicy::Policy vPolicy = QSizePolicy::Minimum)
~QSpacerItem()
void changeSize(int w, int h, QSizePolicy::Policy hPolicy = QSizePolicy::Minimum, QSizePolicy::Policy vPolicy = QSizePolicy::Minimum)

Reimplemented Public Functions

virtual Qt::Orientations expandingDirections() const
virtual QRect geometry() const
virtual bool isEmpty() const
virtual QSize maximumSize() const
virtual QSize minimumSize() const
virtual void setGeometry(const QRect & r)
virtual QSize sizeHint() const
virtual QSpacerItem * spacerItem()

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:

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.

QSpacerItem::​~QSpacerItem()

Destructor.

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

[virtual] Qt::Orientations QSpacerItem::​expandingDirections() const

Reimplemented from QLayoutItem::expandingDirections().

[virtual] QRect QSpacerItem::​geometry() const

Reimplemented from QLayoutItem::geometry().

See also setGeometry().

[virtual] bool QSpacerItem::​isEmpty() const

Reimplemented from QLayoutItem::isEmpty().

Returns true.

[virtual] QSize QSpacerItem::​maximumSize() const

Reimplemented from QLayoutItem::maximumSize().

[virtual] QSize QSpacerItem::​minimumSize() const

Reimplemented from QLayoutItem::minimumSize().

[virtual] void QSpacerItem::​setGeometry(const QRect & r)

Reimplemented from QLayoutItem::setGeometry().

See also geometry().

[virtual] QSize QSpacerItem::​sizeHint() const

Reimplemented from QLayoutItem::sizeHint().

[virtual] QSpacerItem * QSpacerItem::​spacerItem()

Reimplemented from QLayoutItem::spacerItem().

Returns a pointer to this object.

© 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.