Drop-down tool button that behaves like a drop-down combo-box. More...
#include <QtxToolButton.h>

Public Slots | |
| void | clear () |
| Clear widget. More... | |
| void | setCurrentIndex (int) |
| Set current item by given index. More... | |
| void | setCurrentText (const QString &) |
| Set current item by given text. More... | |
Signals | |
| void | activated (int) |
| void | activated (const QString &) |
| void | currentIndexChanged (int) |
| void | currentIndexChanged (const QString &) |
| void | currentTextChanged (const QString &) |
Public Member Functions | |
| QtxToolButton (QWidget *=0) | |
| Constructor. More... | |
| virtual | ~QtxToolButton () |
| Destructor. More... | |
| int | addItem (const QString &, const QVariant &=QVariant()) |
| Add an item with the given text, and containing the specified userData. The item is appended to the list of existing items. More... | |
| int | addItem (const QIcon &, const QString &, const QVariant &=QVariant()) |
| Add an item with the given icon and text, and containing the specified userData. The item is appended to the list of existing items. More... | |
| void | addItems (const QStringList &) |
| Add items with given texts. Each item is appended to the list of existing items in turn. More... | |
| int | addSeparator (const QString &=QString()) |
| Add separator to the end of the items list. More... | |
| int | addSeparator (const QIcon &, const QString &) |
| Add separator to the end of the items list. More... | |
| void | removeItem (int) |
| Remove item with given index. More... | |
| int | count () const |
| Get the number of items. More... | |
| QVariant | currentData () const |
| Get data of the current item. More... | |
| int | currentIndex () const |
| Get index of current item. More... | |
| QString | currentText () const |
| Get text of current item. More... | |
| QVariant | itemData (int) const |
| Get custom data of the item at given index. More... | |
| QIcon | itemIcon (int) const |
| Get icon of the item at given index. More... | |
| QString | itemText (int) const |
| Get text of the item at given index. More... | |
| void | setItemData (int, const QVariant &) |
| Set custom data of the item at given index. More... | |
| void | setItemIcon (int, const QIcon &) |
| Set icon of the item at given index. More... | |
| void | setItemText (int, const QString &) |
| Set text of the item at given index. More... | |
| int | findText (const QString &) |
| Search item with given text. More... | |
Protected Member Functions | |
| void | keyPressEvent (QKeyEvent *) |
| Reimplemented from QToolButton::keyPressEvent(). Process key press event. More... | |
| void | wheelEvent (QWheelEvent *) |
| Reimplemented from QToolButton::wheelEvent(). Process mouse wheel event. More... | |
Private Types | |
| enum | Move { NoMove =0, MoveUp, MoveDown, MoveFirst, MoveLast } |
Private Slots | |
| void | actionTriggered (QAction *) |
| Called when menu action is triggered. More... | |
Private Member Functions | |
| void | internalUpdate () |
| Update content of the widget. More... | |
| QAction * | actionAt (int) const |
| Get menu action at given index. More... | |
| void | moveIndex (Move) |
| Move current index. More... | |
| void | emitCurrentChanged (bool, bool) |
Emit currentChanged() signal. More... | |
In contrast to the standard combo box, QtxToolButton can show drop-down menu containing groups of items where each group has a separate title.
|
private |
| QtxToolButton::QtxToolButton | ( | QWidget * | parent = 0 | ) |
| parent | Parent widget. |
References actionTriggered().
|
virtual |
|
privateslot |
References currentIndex(), emitCurrentChanged(), and internalUpdate().
|
signal |
|
signal |
| text | Item's text. |
| userData | Item's data. |
References count(), emitCurrentChanged(), and internalUpdate().
| int QtxToolButton::addItem | ( | const QIcon & | icon, |
| const QString & | text, | ||
| const QVariant & | userData = QVariant() |
||
| ) |
| text | Item's text. |
| icon | Item's icon. |
| userData | Item's data. |
References count(), emitCurrentChanged(), and internalUpdate().
| void QtxToolButton::addItems | ( | const QStringList & | texts | ) |
| texts | Items being added. |
References count(), emitCurrentChanged(), and internalUpdate().
| int QtxToolButton::addSeparator | ( | const QString & | text = QString() | ) |
| text | Separator's text. |
References actionAt(), and count().
| icon | Separator's icon. |
| text | Separator's text. |
References actionAt(), and count().
|
slot |
References emitCurrentChanged(), and internalUpdate().
| int QtxToolButton::count | ( | ) | const |
| QVariant QtxToolButton::currentData | ( | ) | const |
| int QtxToolButton::currentIndex | ( | ) | const |
|
signal |
|
signal |
| QString QtxToolButton::currentText | ( | ) | const |
|
signal |
|
private |
References activated(), currentIndexChanged(), and currentTextChanged().
| int QtxToolButton::findText | ( | const QString & | text | ) |
| Item's | text. |
References actionAt(), and count().
|
private |
| QVariant QtxToolButton::itemData | ( | int | index | ) | const |
| index | Item's index. |
References actionAt().
| QIcon QtxToolButton::itemIcon | ( | int | index | ) | const |
| QString QtxToolButton::itemText | ( | int | index | ) | const |
|
protected |
|
private |
References actionAt(), count(), currentIndex(), emitCurrentChanged(), internalUpdate(), MoveDown, MoveFirst, MoveLast, and MoveUp.
| void QtxToolButton::removeItem | ( | int | index | ) |
| index | Index of item to be removed. |
References actionAt(), count(), emitCurrentChanged(), and internalUpdate().
|
slot |
| index | Item's index. |
References actionAt(), count(), currentIndex(), emitCurrentChanged(), and internalUpdate().
|
slot |
| index | Item's index. |
References findText(), and setCurrentIndex().
| void QtxToolButton::setItemData | ( | int | index, |
| const QVariant & | value | ||
| ) |
| index | Item's index. |
| value | Item's data. |
References actionAt().
| void QtxToolButton::setItemIcon | ( | int | index, |
| const QIcon & | icon | ||
| ) |
| index | Item's index. |
| icon | Item's icon. |
References actionAt(), and internalUpdate().
| void QtxToolButton::setItemText | ( | int | index, |
| const QString & | text | ||
| ) |
| index | Item's index. |
| text | Item's text. |
References actionAt(), currentTextChanged(), and internalUpdate().
|
protected |