QToolBox Class | Qt Widgets (original) (raw)

Member Function Documentation

[explicit] QToolBox::QToolBox(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags())

Constructs a new toolbox with the given parent and the flags, f.

[virtual noexcept] QToolBox::~QToolBox()

Destroys the toolbox.

int QToolBox::addItem(QWidget *widget, const QIcon &iconSet, const QString &text)

Adds the widget in a new tab at bottom of the toolbox. The new tab's text is set to text, and the iconSet is displayed to the left of the text. Returns the new tab's index.

int QToolBox::addItem(QWidget *w, const QString &text)

This is an overloaded function.

Adds the widget w in a new tab at bottom of the toolbox. The new tab's text is set to text. Returns the new tab's index.

[override virtual protected] void QToolBox::changeEvent(QEvent *ev)

Reimplements: QFrame::changeEvent(QEvent *ev).

[signal] void QToolBox::currentChanged(int index)

This signal is emitted when the current item is changed. The new current item's index is passed in index, or -1 if there is no current item.

QWidget *QToolBox::currentWidget() const

Returns a pointer to the current widget, or nullptr if there is no such item.

See also currentIndex() and setCurrentWidget().

[override virtual protected] bool QToolBox::event(QEvent *e)

Reimplements: QFrame::event(QEvent *e).

int QToolBox::indexOf(const QWidget *widget) const

Returns the index of widget, or -1 if the item does not exist.

int QToolBox::insertItem(int index, QWidget *widget, const QIcon &icon, const QString &text)

Inserts the widget at position index, or at the bottom of the toolbox if index is out of range. The new item's text is set to text, and the icon is displayed to the left of the text. Returns the new item's index.

int QToolBox::insertItem(int index, QWidget *widget, const QString &text)

This is an overloaded function.

Inserts the widget at position index, or at the bottom of the toolbox if index is out of range. The new item's text is set to text. Returns the new item's index.

bool QToolBox::isItemEnabled(int index) const

Returns true if the item at position index is enabled; otherwise returns false.

QIcon QToolBox::itemIcon(int index) const

Returns the icon of the item at position index, or a null icon if index is out of range.

See also setItemIcon().

[virtual protected] void QToolBox::itemInserted(int index)

This virtual handler is called after a new item was added or inserted at position index.

See also itemRemoved().

[virtual protected] void QToolBox::itemRemoved(int index)

This virtual handler is called after an item was removed from position index.

See also itemInserted().

QString QToolBox::itemText(int index) const

Returns the text of the item at position index, or an empty string if index is out of range.

See also setItemText().

QString QToolBox::itemToolTip(int index) const

Returns the tooltip of the item at position index, or an empty string if index is out of range.

See also setItemToolTip().

void QToolBox::removeItem(int index)

Removes the item at position index from the toolbox. Note that the widget is not deleted.

[slot] void QToolBox::setCurrentWidget(QWidget *widget)

Makes_widget_ the current widget. The widget must be an item in this tool box.

See also addItem(), setCurrentIndex(), and currentWidget().

void QToolBox::setItemEnabled(int index, bool enabled)

If enabled is true then the item at position index is enabled; otherwise the item at position index is disabled.

See also isItemEnabled().

void QToolBox::setItemIcon(int index, const QIcon &icon)

Sets the icon of the item at position index to icon.

See also itemIcon().

void QToolBox::setItemText(int index, const QString &text)

Sets the text of the item at position index to text.

If the provided text contains an ampersand character ('&'), a mnemonic is automatically created for it. The character that follows the '&' will be used as the shortcut key. Any previous mnemonic will be overwritten, or cleared if no mnemonic is defined by the text. See the QShortcut documentation for details (to display an actual ampersand, use '&&').

See also itemText().

void QToolBox::setItemToolTip(int index, const QString &toolTip)

Sets the tooltip of the item at position index to toolTip.

See also itemToolTip().

[override virtual protected] void QToolBox::showEvent(QShowEvent *e)

Reimplements: QWidget::showEvent(QShowEvent *event).

QWidget *QToolBox::widget(int index) const

Returns the widget at position index, or nullptr if there is no such item.