QLayoutItem Class
The QLayoutItem class provides an abstract item that a QLayout manipulates. More…
| Header | #include <QLayoutItem> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Widgets) |
| Module | Nt Widgets C++ Classes |
| Inherited by | QLayout, QSpacerItem, QWidgetItem |
List of all members, including inherited members
Public Functions
| QLayoutItem(Qt::Alignment alignment = Qt::Alignment()) | |
| virtual | ~QLayoutItem() |
| virtual QSize | sizeHint() const |
| virtual QSize | minimumSize() const |
| virtual QSize | maximumSize() const |
| virtual Qt::Orientations | expandingDirections() const |
| virtual void | setGeometry(const QRect &rect) |
| virtual QRect | geometry() const |
| virtual bool | isEmpty() const |
| virtual void | invalidate() |
| virtual QWidget * | widget() const |
| virtual QLayout * | layout() |
| virtual QSpacerItem * | spacerItem() |
| Qt::Alignment | alignment() const |
| void | setAlignment(Qt::Alignment alignment) |
Detailed Description
A layout arranges items: widgets (QWidgetItem), blank space (QSpacerItem) and other layouts. A layout asks each item for its size hint, minimum and maximum size, and tells it where it is placed with setGeometry().
See also QLayout, QWidgetItem and QSpacerItem.
Differences from Qt
There is no height-for-width support: hasHeightForWidth(), heightForWidth() and minimumHeightForWidth() do not exist. There is no controlTypes() or spacerItem() on QWidgetItem other than the one here.
Member Function Documentation
QLayoutItem::QLayoutItem(Qt::Alignment alignment = Qt::Alignment())
Constructs an item with the given alignment.
QLayoutItem::~QLayoutItem()
Destroys the item.
Qt::Alignment QLayoutItem::alignment() const
Returns how the item is aligned in the space it gets. The default, no alignment, lets it fill the space.
See also setAlignment().
Qt::Orientations QLayoutItem::expandingDirections() const
Returns the directions in which the item wants to get more space than its size hint.
QRect QLayoutItem::geometry() const
Returns the rectangle that the item was placed in.
void QLayoutItem::invalidate()
Tells the item that its size hint may have changed. The default does nothing.
bool QLayoutItem::isEmpty() const
Returns true if the item takes no space, as a hidden widget does.
QLayout * QLayoutItem::layout()
Returns the layout of the item, or nullptr if it is not a layout.
QSize QLayoutItem::maximumSize() const
Returns the largest size that the item can have.
QSize QLayoutItem::minimumSize() const
Returns the smallest size that the item can have.
void QLayoutItem::setAlignment(Qt::Alignment alignment)
Sets the alignment of the item to alignment.
See also alignment().
void QLayoutItem::setGeometry(const QRect &rect)
Places the item in rect, which is in the coordinates of the widget that the layout manages.
QSize QLayoutItem::sizeHint() const
Returns the size that the item would like to have.
QSpacerItem * QLayoutItem::spacerItem()
Returns the item as a QSpacerItem, or nullptr if it is not a spacer.
QWidget * QLayoutItem::widget() const
Returns the widget of the item, or nullptr if it is not a widget item.