QWidgetItem Class | Qt Widgets 5.6

Qt 5.6 | Qt Widgets | C++ Classes | QWidgetItem

Qt 5.6.2 Reference Documentation

# QWidgetItem Class

The QWidgetItem class is a layout item that represents a widget. More...

Header: | #include <QWidgetItem>
qmake: | QT += widgets
Inherits: | QLayoutItem

- List of all members, including inherited members

## Public Functions

| QWidgetItem(QWidget *widget)
| ~QWidgetItem()

## Reimplemented Public Functions

virtual QSizePolicy::ControlTypes | controlTypes() const
virtual Qt::Orientations | expandingDirections() const
virtual QRect | geometry() const
virtual bool | hasHeightForWidth() const
virtual int | heightForWidth(int w) const
virtual bool | isEmpty() const
virtual QSize | maximumSize() const
virtual QSize | minimumSize() const
virtual void | setGeometry(const QRect &rect)
virtual QSize | sizeHint() const
virtual QWidget * | widget()

- 17 public functions inherited from QLayoutItem

## Detailed Description

The QWidgetItem class is a layout item that represents a widget.

Normally, you don't need to use this class directly. Qt's built-in layout managers provide the following functions for manipulating widgets in layouts:

Class | Functions
--- | ---
QBoxLayout | addWidget(), insertWidget(), setStretchFactor()
QGridLayout | addWidget()
QStackedLayout | addWidget(), insertWidget(), currentWidget(), setCurrentWidget(), widget()

See also QLayout, QSpacerItem, and QLayoutItem::widget().

## Member Function Documentation

### QWidgetItem::QWidgetItem(QWidget *widget)

Creates an item containing the given widget.

### QWidgetItem::~QWidgetItem()

Destructor.

### `[virtual]` QSizePolicy::ControlTypes QWidgetItem::controlTypes() const

Reimplemented from QLayoutItem::controlTypes().

Returns the control type associated with the widget for which this size policy applies.

See also QSizePolicy::controlType().

### `[virtual]` Qt::Orientations QWidgetItem::expandingDirections() const

Reimplemented from QLayoutItem::expandingDirections().

### `[virtual]` QRect QWidgetItem::geometry() const

Reimplemented from QLayoutItem::geometry().

See also setGeometry().

### `[virtual]` bool QWidgetItem::hasHeightForWidth() const

Reimplemented from QLayoutItem::hasHeightForWidth().

### `[virtual]` int QWidgetItem::heightForWidth(int w) const

Reimplemented from QLayoutItem::heightForWidth().

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

Reimplemented from QLayoutItem::isEmpty().

Returns `true` if the widget is hidden; otherwise returns `false`.

See also QWidget::isHidden().

### `[virtual]` QSize QWidgetItem::maximumSize() const

Reimplemented from QLayoutItem::maximumSize().

### `[virtual]` QSize QWidgetItem::minimumSize() const

Reimplemented from QLayoutItem::minimumSize().

### `[virtual]` void QWidgetItem::setGeometry(const QRect &rect)

Reimplemented from QLayoutItem::setGeometry().

See also geometry().

### `[virtual]` QSize QWidgetItem::sizeHint() const

Reimplemented from QLayoutItem::sizeHint().

### `[virtual]` QWidget *QWidgetItem::widget()

Reimplemented from QLayoutItem::widget().

Returns the widget managed by this item.