Enhanced version of Qt combo box class. More...
#include <QtxComboBox.h>

Data Structures | |
| class | ClearEvent |
| Custom event, used to process 'cleared' state of the combo box in the editable mode. More... | |
| class | Model |
| Internal view model, used to process 'cleared' state of the combo box. More... | |
Signals | |
| void | activatedId (int) |
| Emitted when the item with identificator id is activated. | |
Public Member Functions | |
| QtxComboBox (QWidget *=0) | |
| Constructor. | |
| virtual | ~QtxComboBox () |
| Destructor. | |
| bool | isCleared () const |
| Check if the combo box is in the "cleared" state. | |
| void | setCleared (const bool) |
| Set "cleared" state. | |
| int | currentId () const |
| Get current item ID. | |
| void | setCurrentId (int) |
| Set current item by ID. | |
| int | id (const int) const |
| Get item ID by the index. | |
| int | index (const int) const |
| Get item index by the ID. | |
| bool | hasId (const int) const |
| Returns true if the item with index has ID. | |
| void | setId (const int, const int) |
| Set the identifier to specified item. | |
Protected Member Functions | |
| virtual void | paintEvent (QPaintEvent *) |
| Customize paint event. | |
| virtual void | childEvent (QChildEvent *) |
| Customize child addition/removal event. | |
| virtual void | customEvent (QEvent *) |
| Process custom events. | |
Private Types | |
| enum | { IdRole = Qt::UserRole + 10 } |
Private Slots | |
| void | onCurrentChanged (int) |
| Called when current item is chaned (by the user or programmatically). | |
Private Member Functions | |
| void | resetClear () |
| Reset "cleared" state and update the combo box. | |
Private Attributes | |
| bool | myCleared |
| "cleared" state | |
In addition to the QComboBox class, QtxComboBox supports adding/removing the items with the associated unique identifiers. It also provides a way to set "cleared" state to the combo box - when no item is selected.
| QtxComboBox::QtxComboBox | ( | QWidget * | parent = 0 | ) |
| parent | parent widget |
References onCurrentChanged().
| QtxComboBox::~QtxComboBox | ( | ) | [virtual] |
Does nothing currently.
| bool QtxComboBox::isCleared | ( | ) | const |
true if combobox is in the "cleared" state References myCleared.
| void QtxComboBox::setCleared | ( | const bool | isClear | ) |
| isClear | new "cleared" state |
References myCleared.
| int QtxComboBox::currentId | ( | ) | const |
References id().
| void QtxComboBox::setCurrentId | ( | int | num | ) |
| num | item ID |
References index().
| int QtxComboBox::id | ( | const int | idx | ) | const |
| int QtxComboBox::index | ( | const int | ident | ) | const |
| id | item ID |
| bool QtxComboBox::hasId | ( | const int | idx | ) | const |
| idx | item index |
References IdRole.
| void QtxComboBox::setId | ( | const int | index, |
| const int | id | ||
| ) |
| index | - index of the item |
| id | - identifier of the item |
References IdRole.
| void QtxComboBox::activatedId | ( | int | id | ) | [signal] |
| id | item ID |
| void QtxComboBox::onCurrentChanged | ( | int | idx | ) | [private, slot] |
| idx | item being set current |
References activatedId(), and resetClear().
| void QtxComboBox::paintEvent | ( | QPaintEvent * | e | ) | [protected, virtual] |
| e | paint event |
References myCleared, and QtxComboBox.Model.setCleared().
| void QtxComboBox::childEvent | ( | QChildEvent * | e | ) | [protected, virtual] |
| e | child event |
| void QtxComboBox::customEvent | ( | QEvent * | e | ) | [protected, virtual] |
| e | custom event |
References CLEAR_EVENT, and myCleared.
| void QtxComboBox::resetClear | ( | ) | [private] |
References myCleared.
bool QtxComboBox.myCleared [private] |