QSpacerItem Class▲
-
Header: QSpacerItem
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
-
qmake: QT += widgets
-
Inherits: QLayoutItem
-
Group: QSpacerItem is part of geomanagement
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 |
Functions |
---|---|
addSpacing(), addStretch(), insertSpacing(), insertStretch() |
|
setRowMinimumHeight(), setRowStretch(), setColumnMinimumWidth(), setColumnStretch() |
See Also▲
See also QLayout, QWidgetItem, 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.
[virtual] 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▲
See also QSpacerItem::invalidate()
[override virtual] Qt::Orientations QSpacerItem::expandingDirections() const▲
Reimplements: QLayoutItem::expandingDirections() const.
[override virtual] QRect QSpacerItem::geometry() const▲
[override virtual] bool QSpacerItem::isEmpty() const▲
Reimplements: QLayoutItem::isEmpty() const.
Returns true.
[override virtual] QSize QSpacerItem::maximumSize() const▲
Reimplements: QLayoutItem::maximumSize() const.
[override virtual] QSize QSpacerItem::minimumSize() const▲
Reimplements: QLayoutItem::minimumSize() const.
[override virtual] void QSpacerItem::setGeometry(const QRect &r)▲
[override virtual] QSize QSpacerItem::sizeHint() const▲
Reimplements: QLayoutItem::sizeHint() const.
[since 5.5] QSizePolicy QSpacerItem::sizePolicy() const▲
Returns the size policy of this item.
This function was introduced in Qt 5.5.
[override virtual] QSpacerItem *QSpacerItem::spacerItem()▲
Reimplements: QLayoutItem::spacerItem().
Returns a pointer to this object.