Version: 6.3.1
Data Structures | Signals | Public Member Functions | Protected Member Functions | Private Types | Private Slots | Private Member Functions | Private Attributes

QtxComboBox Class Reference

Enhanced version of Qt combo box class. More...

#include <QtxComboBox.h>

Inheritance diagram for QtxComboBox:
Inheritance graph

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

Detailed Description

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.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
IdRole 

Constructor & Destructor Documentation

QtxComboBox::QtxComboBox ( QWidget parent = 0)
Parameters:
parentparent widget

References onCurrentChanged().

QtxComboBox::~QtxComboBox ( ) [virtual]

Does nothing currently.


Member Function Documentation

bool QtxComboBox::isCleared ( ) const
Returns:
true if combobox is in the "cleared" state

References myCleared.

void QtxComboBox::setCleared ( const bool  isClear)
Parameters:
isClearnew "cleared" state

References myCleared.

int QtxComboBox::currentId ( ) const
Returns:
item id

References id().

void QtxComboBox::setCurrentId ( int  num)
Parameters:
numitem ID

References index().

int QtxComboBox::id ( const int  idx) const
Parameters:
idxitem index
Returns:
item ID or -1 if index is invalid.

References IdRole.

int QtxComboBox::index ( const int  ident) const
Parameters:
iditem ID
Returns:
item index or -1 if ID is invalid.
bool QtxComboBox::hasId ( const int  idx) const
Parameters:
idxitem index

References IdRole.

void QtxComboBox::setId ( const int  index,
const int  id 
)
Parameters:
index- index of the item
id- identifier of the item

References IdRole.

void QtxComboBox::activatedId ( int  id) [signal]
Parameters:
iditem ID
void QtxComboBox::onCurrentChanged ( int  idx) [private, slot]
Parameters:
idxitem being set current

References activatedId(), and resetClear().

void QtxComboBox::paintEvent ( QPaintEvent *  e) [protected, virtual]
Parameters:
epaint event

References myCleared, and QtxComboBox.Model.setCleared().

void QtxComboBox::childEvent ( QChildEvent *  e) [protected, virtual]
Parameters:
echild event
void QtxComboBox::customEvent ( QEvent e) [protected, virtual]
Parameters:
ecustom event

References CLEAR_EVENT, and myCleared.

void QtxComboBox::resetClear ( ) [private]

References myCleared.


Field Documentation

bool QtxComboBox.myCleared [private]
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS