6.0.0-rc4Source

QLayoutItem Class

The QLayoutItem class provides an abstract item that a QLayout manipulates. More…

Header#include <QLayoutItem>
CMaketarget_link_libraries(app PRIVATE Nt::Widgets)
ModuleNt Widgets C++ Classes
Inherited byQLayout, QSpacerItem, QWidgetItem

List of all members, including inherited members

Public Functions

QLayoutItem(Qt::Alignment alignment = Qt::Alignment())
virtual ~QLayoutItem()
virtual QSizesizeHint() const
virtual QSizeminimumSize() const
virtual QSizemaximumSize() const
virtual Qt::OrientationsexpandingDirections() const
virtual voidsetGeometry(const QRect &rect)
virtual QRectgeometry() const
virtual boolisEmpty() const
virtual voidinvalidate()
virtual QWidget *widget() const
virtual QLayout *layout()
virtual QSpacerItem *spacerItem()
Qt::Alignmentalignment() const
voidsetAlignment(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

[explicit] QLayoutItem::QLayoutItem(Qt::Alignment alignment = Qt::Alignment())

Constructs an item with the given alignment.

[virtual] 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().

[virtual] Qt::Orientations QLayoutItem::expandingDirections() const

Returns the directions in which the item wants to get more space than its size hint.

[virtual] QRect QLayoutItem::geometry() const

Returns the rectangle that the item was placed in.

[virtual] void QLayoutItem::invalidate()

Tells the item that its size hint may have changed. The default does nothing.

[virtual] bool QLayoutItem::isEmpty() const

Returns true if the item takes no space, as a hidden widget does.

[virtual] QLayout * QLayoutItem::layout()

Returns the layout of the item, or nullptr if it is not a layout.

[virtual] QSize QLayoutItem::maximumSize() const

Returns the largest size that the item can have.

[virtual] 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().

[virtual] void QLayoutItem::setGeometry(const QRect &rect)

Places the item in rect, which is in the coordinates of the widget that the layout manages.

[virtual] QSize QLayoutItem::sizeHint() const

Returns the size that the item would like to have.

[virtual] QSpacerItem * QLayoutItem::spacerItem()

Returns the item as a QSpacerItem, or nullptr if it is not a spacer.

[virtual] QWidget * QLayoutItem::widget() const

Returns the widget of the item, or nullptr if it is not a widget item.