- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties

# QComboBox Class Reference

Search for all occurrences

## Detailed Description

Definition at line 62 of file qcombobox.h.

`#include <qcombobox.h>`

Inheritance diagram for QComboBox:
[legend]

List of all members.

## Public Types
enum | InsertPolicy { NoInsert, InsertAtTop, InsertAtCurrent, InsertAtBottom, InsertAfterCurrent, InsertBeforeCurrent, InsertAlphabetically }
enum | SizeAdjustPolicy { AdjustToContents, AdjustToContentsOnFirstShow, AdjustToMinimumContentsLength, AdjustToMinimumContentsLengthWithIcon }
## Public Slots
void | clear ()
void | clearEditText ()
void | setEditText (const QString &text)
void | setCurrentIndex (int index)
## Signals
void | editTextChanged (const QString &)
void | activated (int index)
void | activated (const QString &)
void | highlighted (int index)
void | highlighted (const QString &)
void | currentIndexChanged (int index)
void | currentIndexChanged (const QString &)
## Public Member Functions
| QComboBox (QWidget *parent=0)
| ~QComboBox ()
int | maxVisibleItems () const
void | setMaxVisibleItems (int maxItems)
int | count () const
void | setMaxCount (int max)
int | maxCount () const
bool | autoCompletion () const
void | setAutoCompletion (bool enable)
Qt::CaseSensitivity | autoCompletionCaseSensitivity () const
void | setAutoCompletionCaseSensitivity (Qt::CaseSensitivity sensitivity)
bool | duplicatesEnabled () const
void | setDuplicatesEnabled (bool enable)
void | setFrame (bool)
bool | hasFrame () const
int | findText (const QString &text, Qt::MatchFlags flags=static_cast< Qt::MatchFlags >(Qt::MatchExactly|Qt::MatchCaseSensitive)) const
int | findData (const QVariant &data, int role=Qt::UserRole, Qt::MatchFlags flags=static_cast< Qt::MatchFlags >(Qt::MatchExactly|Qt::MatchCaseSensitive)) const
InsertPolicy | insertPolicy () const
void | setInsertPolicy (InsertPolicy policy)
SizeAdjustPolicy | sizeAdjustPolicy () const
void | setSizeAdjustPolicy (SizeAdjustPolicy policy)
int | minimumContentsLength () const
void | setMinimumContentsLength (int characters)
QSize | iconSize () const
void | setIconSize (const QSize &size)
bool | isEditable () const
void | setEditable (bool editable)
void | setLineEdit (QLineEdit *edit)
QLineEdit * | lineEdit () const
void | setValidator (const QValidator *v)
const QValidator * | validator () const
void | setCompleter (QCompleter *c)
QCompleter * | completer () const
QAbstractItemDelegate * | itemDelegate () const
void | setItemDelegate (QAbstractItemDelegate *delegate)
QAbstractItemModel * | model () const
void | setModel (QAbstractItemModel *model)
QModelIndex | rootModelIndex () const
void | setRootModelIndex (const QModelIndex &index)
int | modelColumn () const
void | setModelColumn (int visibleColumn)
int | currentIndex () const
QString | currentText () const
QString | itemText (int index) const
QIcon | itemIcon (int index) const
QVariant | itemData (int index, int role=Qt::UserRole) const
void | addItem (const QString &text, const QVariant &userData=QVariant())
void | addItem (const QIcon &icon, const QString &text, const QVariant &userData=QVariant())
void | addItems (const QStringList &texts)
void | insertItem (int index, const QString &text, const QVariant &userData=QVariant())
void | insertItem (int index, const QIcon &icon, const QString &text, const QVariant &userData=QVariant())
void | insertItems (int index, const QStringList &texts)
void | insertSeparator (int index)
void | removeItem (int index)
void | setItemText (int index, const QString &text)
void | setItemIcon (int index, const QIcon &icon)
void | setItemData (int index, const QVariant &value, int role=Qt::UserRole)
QAbstractItemView * | view () const
void | setView (QAbstractItemView *itemView)
QSize | sizeHint () const
QSize | minimumSizeHint () const
virtual void | showPopup ()
virtual void | hidePopup ()
bool | event (QEvent *event)
## Protected Member Functions
void | focusInEvent (QFocusEvent *e)
void | focusOutEvent (QFocusEvent *e)
void | changeEvent (QEvent *e)
void | resizeEvent (QResizeEvent *e)
void | paintEvent (QPaintEvent *e)
void | showEvent (QShowEvent *e)
void | hideEvent (QHideEvent *e)
void | mousePressEvent (QMouseEvent *e)
void | mouseReleaseEvent (QMouseEvent *e)
void | keyPressEvent (QKeyEvent *e)
void | keyReleaseEvent (QKeyEvent *e)
void | wheelEvent (QWheelEvent *e)
void | contextMenuEvent (QContextMenuEvent *e)
void | inputMethodEvent (QInputMethodEvent *)
QVariant | inputMethodQuery (Qt::InputMethodQuery) const
void | initStyleOption (QStyleOptionComboBox *option) const
| QComboBox (QComboBoxPrivate &, QWidget *)
## Properties
bool | editable
int | count
QString | currentText
int | currentIndex
int | maxVisibleItems
int | maxCount
InsertPolicy | insertPolicy
SizeAdjustPolicy | sizeAdjustPolicy
int | minimumContentsLength
QSize | iconSize
bool | autoCompletion
Qt::CaseSensitivity | autoCompletionCaseSensitivity
bool | duplicatesEnabled
bool | frame
int | modelColumn

## Member Enumeration Documentation

enum InsertPolicy

Search for all occurrences

Enumerator:

  NoInsert | Search for all occurrences
  InsertAtTop | Search for all occurrences
  InsertAtCurrent | Search for all occurrences
  InsertAtBottom | Search for all occurrences
  InsertAfterCurrent | Search for all occurrences
  InsertBeforeCurrent | Search for all occurrences
  InsertAlphabetically | Search for all occurrences

Definition at line 119 of file qcombobox.h.

                          {
            NoInsert,
            InsertAtTop,
            InsertAtCurrent,
            InsertAtBottom,
            InsertAfterCurrent,
            InsertBeforeCurrent,
            InsertAlphabetically
    #if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN)
            ,
            NoInsertion = NoInsert,
            AtTop = InsertAtTop,
            AtCurrent = InsertAtCurrent,
            AtBottom = InsertAtBottom,
            AfterCurrent = InsertAfterCurrent,
            BeforeCurrent = InsertBeforeCurrent
    #endif
        };

enum SizeAdjustPolicy

Search for all occurrences

Enumerator:

  AdjustToContents | Search for all occurrences
  AdjustToContentsOnFirstShow | Search for all occurrences
  AdjustToMinimumContentsLength | Search for all occurrences
  AdjustToMinimumContentsLengthWithIcon | Search for all occurrences

Definition at line 144 of file qcombobox.h.

                              {
            AdjustToContents,
            AdjustToContentsOnFirstShow,
            AdjustToMinimumContentsLength, // ### Qt 5: remove
            AdjustToMinimumContentsLengthWithIcon
        };

## Constructor & Destructor Documentation

QComboBox | ( | QWidget * | parent = `0` | ) | `[explicit]`

~QComboBox | ( |  | ) |

QComboBox | ( | QComboBoxPrivate & | ,
|  | QWidget * |
| ) |  | `[protected]`

## Member Function Documentation

int maxVisibleItems | ( |  | ) | const

Search for all occurrences

void setMaxVisibleItems | ( | int | maxItems | ) |

Search for all occurrences

int count | ( |  | ) | const

Search for all occurrences

void setMaxCount | ( | int | max | ) |

Search for all occurrences

int maxCount | ( |  | ) | const

Search for all occurrences

bool autoCompletion | ( |  | ) | const

Search for all occurrences

void setAutoCompletion | ( | bool | enable | ) |

Search for all occurrences

Qt::CaseSensitivity autoCompletionCaseSensitivity | ( |  | ) | const

Search for all occurrences

void setAutoCompletionCaseSensitivity | ( | Qt::CaseSensitivity | sensitivity | ) |

Search for all occurrences

bool duplicatesEnabled | ( |  | ) | const

Search for all occurrences

void setDuplicatesEnabled | ( | bool | enable | ) |

Search for all occurrences

void setFrame | ( | bool |  | ) |

Search for all occurrences

bool hasFrame | ( |  | ) | const

Search for all occurrences

int findText | ( | const QString & | text,
|  | Qt::MatchFlags | flags = `static_cast<Qt::MatchFlags>(Qt::MatchExactly|Qt::MatchCaseSensitive)`
| ) |  | const `[inline]`

Search for all occurrences

Definition at line 113 of file qcombobox.h.

            { return findData(text, Qt::DisplayRole, flags); }

int findData | ( | const QVariant & | data,
|  | int | role = `Qt::UserRole`,
|  | Qt::MatchFlags | flags = `static_cast< Qt::MatchFlags >(Qt::MatchExactly|Qt::MatchCaseSensitive)`
| ) |  | const

Search for all occurrences

InsertPolicy insertPolicy | ( |  | ) | const

Search for all occurrences

void setInsertPolicy | ( | InsertPolicy | policy | ) |

Search for all occurrences

SizeAdjustPolicy sizeAdjustPolicy | ( |  | ) | const

Search for all occurrences

void setSizeAdjustPolicy | ( | SizeAdjustPolicy | policy | ) |

Search for all occurrences

int minimumContentsLength | ( |  | ) | const

Search for all occurrences

void setMinimumContentsLength | ( | int | characters | ) |

Search for all occurrences

QSize iconSize | ( |  | ) | const

Search for all occurrences

void setIconSize | ( | const QSize & | size | ) |

Search for all occurrences

bool isEditable | ( |  | ) | const

Search for all occurrences

void setEditable | ( | bool | editable | ) |

Search for all occurrences

void setLineEdit | ( | QLineEdit * | edit | ) |

Search for all occurrences

QLineEdit* lineEdit | ( |  | ) | const

Search for all occurrences

void setValidator | ( | const QValidator * | v | ) |

Search for all occurrences

const QValidator* validator | ( |  | ) | const

Search for all occurrences

void setCompleter | ( | QCompleter * | c | ) |

Search for all occurrences

QCompleter* completer | ( |  | ) | const

Search for all occurrences

QAbstractItemDelegate* itemDelegate | ( |  | ) | const

Search for all occurrences

void setItemDelegate | ( | QAbstractItemDelegate * | delegate | ) |

Search for all occurrences

QAbstractItemModel* model | ( |  | ) | const

Search for all occurrences

void setModel | ( | QAbstractItemModel * | model | ) |

Search for all occurrences

QModelIndex rootModelIndex | ( |  | ) | const

Search for all occurrences

void setRootModelIndex | ( | const QModelIndex & | index | ) |

Search for all occurrences

int modelColumn | ( |  | ) | const

Search for all occurrences

void setModelColumn | ( | int | visibleColumn | ) |

Search for all occurrences

int currentIndex | ( |  | ) | const

Search for all occurrences

QString currentText | ( |  | ) | const

Search for all occurrences

QString itemText | ( | int | index | ) | const

Search for all occurrences

QIcon itemIcon | ( | int | index | ) | const

Search for all occurrences

QVariant itemData | ( | int | index,
|  | int | role = `Qt::UserRole`
| ) |  | const

Search for all occurrences

void addItem | ( | const QString & | text,
|  | const QVariant & | userData = `QVariant()`
| ) |  | `[inline]`

Search for all occurrences

Definition at line 323 of file qcombobox.h.

    { insertItem(count(), atext, auserData); }

void addItem | ( | const QIcon & | icon,
|  | const QString & | text,
|  | const QVariant & | userData = `QVariant()`
| ) |  | `[inline]`

Search for all occurrences

Definition at line 325 of file qcombobox.h.

    { insertItem(count(), aicon, atext, auserData); }

void addItems | ( | const QStringList & | texts | ) | `[inline]`

Search for all occurrences

Definition at line 195 of file qcombobox.h.

            { insertItems(count(), texts); }

void insertItem | ( | int | index,
|  | const QString & | text,
|  | const QVariant & | userData = `QVariant()`
| ) |  | `[inline]`

Search for all occurrences

Definition at line 329 of file qcombobox.h.

    { insertItem(aindex, QIcon(), atext, auserData); }

void insertItem | ( | int | index,
|  | const QIcon & | icon,
|  | const QString & | text,
|  | const QVariant & | userData = `QVariant()`
| ) |  |

Search for all occurrences

void insertItems | ( | int | index,
|  | const QStringList & | texts
| ) |  |

Search for all occurrences

void insertSeparator | ( | int | index | ) |

Search for all occurrences

void removeItem | ( | int | index | ) |

Search for all occurrences

void setItemText | ( | int | index,
|  | const QString & | text
| ) |  |

Search for all occurrences

void setItemIcon | ( | int | index,
|  | const QIcon & | icon
| ) |  |

Search for all occurrences

void setItemData | ( | int | index,
|  | const QVariant & | value,
|  | int | role = `Qt::UserRole`
| ) |  |

Search for all occurrences

QAbstractItemView* view | ( |  | ) | const

Search for all occurrences

void setView | ( | QAbstractItemView * | itemView | ) |

Search for all occurrences

QSize sizeHint | ( |  | ) | const `[virtual]`

Search for all occurrences

Reimplemented from QWidget.

Reimplemented in QFontComboBox.

QSize minimumSizeHint | ( |  | ) | const `[virtual]`

Search for all occurrences

Reimplemented from QWidget.

virtual void showPopup | ( |  | ) | `[virtual]`

Search for all occurrences

virtual void hidePopup | ( |  | ) | `[virtual]`

Search for all occurrences

bool event | ( | QEvent * | event | ) | `[virtual]`

Search for all occurrences

Reimplemented from QWidget.

Reimplemented in QFontComboBox.

void clear | ( |  | ) | `[slot]`

Search for all occurrences

void clearEditText | ( |  | ) | `[slot]`

Search for all occurrences

void setEditText | ( | const QString & | text | ) | `[slot]`

Search for all occurrences

void setCurrentIndex | ( | int | index | ) | `[slot]`

Search for all occurrences

void editTextChanged | ( | const QString & |  | ) | `[signal]`

Search for all occurrences

void activated | ( | int | index | ) | `[signal]`

Search for all occurrences

void activated | ( | const QString & |  | ) | `[signal]`

Search for all occurrences

void highlighted | ( | int | index | ) | `[signal]`

Search for all occurrences

void highlighted | ( | const QString & |  | ) | `[signal]`

Search for all occurrences

void currentIndexChanged | ( | int | index | ) | `[signal]`

Search for all occurrences

void currentIndexChanged | ( | const QString & |  | ) | `[signal]`

Search for all occurrences

void focusInEvent | ( | QFocusEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

void focusOutEvent | ( | QFocusEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

Reimplemented in MirrorComboBox.

void changeEvent | ( | QEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

void resizeEvent | ( | QResizeEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

void paintEvent | ( | QPaintEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

void showEvent | ( | QShowEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

void hideEvent | ( | QHideEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

void mousePressEvent | ( | QMouseEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

void mouseReleaseEvent | ( | QMouseEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

void keyPressEvent | ( | QKeyEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

void keyReleaseEvent | ( | QKeyEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

void wheelEvent | ( | QWheelEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

void contextMenuEvent | ( | QContextMenuEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

void inputMethodEvent | ( | QInputMethodEvent * |  | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

QVariant inputMethodQuery | ( | Qt::InputMethodQuery |  | ) | const `[protected, virtual]`

Search for all occurrences

Reimplemented from QWidget.

void initStyleOption | ( | QStyleOptionComboBox * | option | ) | const `[protected]`

Search for all occurrences

## Property Documentation

bool editable `[read, write]`

Search for all occurrences

Definition at line 68 of file qcombobox.h.

int count `[read]`

Search for all occurrences

Definition at line 69 of file qcombobox.h.

QString currentText `[read]`

Search for all occurrences

Definition at line 70 of file qcombobox.h.

int currentIndex `[read, write]`

Search for all occurrences

Definition at line 71 of file qcombobox.h.

int maxVisibleItems `[read, write]`

Search for all occurrences

Definition at line 72 of file qcombobox.h.

int maxCount `[read, write]`

Search for all occurrences

Definition at line 73 of file qcombobox.h.

InsertPolicy insertPolicy `[read, write]`

Search for all occurrences

Definition at line 74 of file qcombobox.h.

SizeAdjustPolicy sizeAdjustPolicy `[read, write]`

Search for all occurrences

Definition at line 75 of file qcombobox.h.

int minimumContentsLength `[read, write]`

Search for all occurrences

Definition at line 76 of file qcombobox.h.

QSize iconSize `[read, write]`

Search for all occurrences

Definition at line 77 of file qcombobox.h.

bool autoCompletion `[read, write]`

Search for all occurrences

Definition at line 80 of file qcombobox.h.

Qt::CaseSensitivity autoCompletionCaseSensitivity `[read, write]`

Search for all occurrences

Definition at line 81 of file qcombobox.h.

bool duplicatesEnabled `[read, write]`

Search for all occurrences

Definition at line 84 of file qcombobox.h.

bool frame `[read, write]`

Search for all occurrences

Definition at line 85 of file qcombobox.h.

int modelColumn `[read, write]`

Search for all occurrences

Definition at line 86 of file qcombobox.h.

The documentation for this class was generated from the following file:

- QtGui/qcombobox.h

QComboBox QComboBox QComboBox QComboBox QComboBox QComboBox QComboBox QComboBox QComboBox QComboBox
QComboBox QComboBox QComboBox QComboBox QComboBox QComboBox QComboBox QComboBox QComboBox QComboBox