
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQToolBox class provides a column of tabbed widget items.More...
| Header: | #include <QToolBox> |
| Inherits: | QFrame |
| QToolBox(QWidget * parent = 0, Qt::WindowFlags f = 0) | |
| ~QToolBox() | |
| int | addItem(QWidget * widget, const QIcon & iconSet, const QString & text) |
| int | addItem(QWidget * w, const QString & text) |
| int | count() const |
| int | currentIndex() const |
| QWidget * | currentWidget() const |
| int | indexOf(QWidget * widget) const |
| int | insertItem(int index, QWidget * widget, const QIcon & icon, const QString & text) |
| int | insertItem(int index, QWidget * widget, const QString & text) |
| bool | isItemEnabled(int index) const |
| QIcon | itemIcon(int index) const |
| QString | itemText(int index) const |
| QString | itemToolTip(int index) const |
| void | removeItem(int index) |
| void | setItemEnabled(int index, bool enabled) |
| void | setItemIcon(int index, const QIcon & icon) |
| void | setItemText(int index, const QString & text) |
| void | setItemToolTip(int index, const QString & toolTip) |
| QWidget * | widget(int index) const |
| void | setCurrentIndex(int index) |
| void | setCurrentWidget(QWidget * widget) |
| void | currentChanged(int index) |
| virtual void | itemInserted(int index) |
| virtual void | itemRemoved(int index) |
| virtual void | changeEvent(QEvent * ev) |
| virtual bool | event(QEvent * e) |
| virtual void | showEvent(QShowEvent * e) |
TheQToolBox class provides a column of tabbed widget items.
A toolbox is a widget that displays a column of tabs one above the other, with the current item displayed below the current tab. Every tab has an index position within the column of tabs. A tab's item is aQWidget.
Each item has anitemText(), an optionalitemIcon(), an optionalitemToolTip(), and awidget(). The item's attributes can be changed withsetItemText(),setItemIcon(), andsetItemToolTip(). Each item can be enabled or disabled individually withsetItemEnabled().
Items are added usingaddItem(), or inserted at particular positions usinginsertItem(). The total number of items is given bycount(). Items can be deleted with delete, or removed from the toolbox withremoveItem(). CombiningremoveItem() andinsertItem() allows you to move items to different positions.
The index of the current item widget is returned bycurrentIndex(), and set withsetCurrentIndex(). The index of a particular item can be found usingindexOf(), and the item at a given index is returned byitem().
ThecurrentChanged() signal is emitted when the current item is changed.
See alsoQTabWidget.
This property holds the number of items contained in the toolbox.
By default, this property has a value of 0.
Access functions:
| int | count() const |
This property holds the index of the current item.
By default, for an empty toolbox, this property has a value of -1.
Access functions:
| int | currentIndex() const |
| void | setCurrentIndex(int index) |
Notifier signal:
| void | currentChanged(int index) |
Constructs a new toolbox with the givenparent and the flags,f.
Destroys the toolbox.
Adds thewidget in a new tab at bottom of the toolbox. The new tab's text is set totext, and theiconSet is displayed to the left of thetext. Returns the new tab's index.
This is an overloaded function.
Adds the widgetw in a new tab at bottom of the toolbox. The new tab's text is set totext. Returns the new tab's index.
[virtual protected]void QToolBox::changeEvent(QEvent * ev)Reimplemented fromQWidget::changeEvent().
Returns a pointer to the current widget, or 0 if there is no such item.
See alsocurrentIndex() andsetCurrentWidget().
[virtual protected]bool QToolBox::event(QEvent * e)Reimplemented fromQObject::event().
Returns the index ofwidget, or -1 if the item does not exist.
Inserts thewidget at positionindex, or at the bottom of the toolbox ifindex is out of range. The new item's text is set totext, and theicon is displayed to the left of thetext. Returns the new item's index.
This is an overloaded function.
Inserts thewidget at positionindex, or at the bottom of the toolbox ifindex is out of range. The new item's text is set totext. Returns the new item's index.
Returns true if the item at positionindex is enabled; otherwise returns false.
Returns the icon of the item at positionindex, or a null icon ifindex is out of range.
See alsosetItemIcon().
[virtual protected]void QToolBox::itemInserted(int index)This virtual handler is called after a new item was added or inserted at positionindex.
See alsoitemRemoved().
[virtual protected]void QToolBox::itemRemoved(int index)This virtual handler is called after an item was removed from positionindex.
See alsoitemInserted().
Returns the text of the item at positionindex, or an empty string ifindex is out of range.
See alsosetItemText().
Returns the tooltip of the item at positionindex, or an empty string ifindex is out of range.
See alsosetItemToolTip().
Removes the item at positionindex from the toolbox. Note that the widget isnot deleted.
[slot]void QToolBox::setCurrentWidget(QWidget * widget)Makeswidget the current widget. Thewidget must be an item in this tool box.
See alsoaddItem(),setCurrentIndex(), andcurrentWidget().
Ifenabled is true then the item at positionindex is enabled; otherwise the item at positionindex is disabled.
See alsoisItemEnabled().
Sets the icon of the item at positionindex toicon.
See alsoitemIcon().
Sets the text of the item at positionindex totext.
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 theQShortcut documentation for details (to display an actual ampersand, use '&&').
See alsoitemText().
Sets the tooltip of the item at positionindex totoolTip.
See alsoitemToolTip().
[virtual protected]void QToolBox::showEvent(QShowEvent * e)Reimplemented fromQWidget::showEvent().
Returns the widget at positionindex, or 0 if there is no such item.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.