QComboBox Class Reference

The QComboBox widget is a combined button and popup list.

  1. #include <QComboBox>

Inherits: QWidget.

Inherited by: QFontComboBox.

Detailed Description

The QComboBox widget is a combined button and popup list.

A QComboBox provides a means of presenting a list of options to the user in a way that takes up the minimum amount of screen space.

A combobox is a selection widget that displays the current item, and can pop up a list of selectable items. A combobox may be editable, allowing the user to modify each item in the list.

Comboboxes can contain pixmaps as well as strings; the insertItem() and setItemText() functions are suitably overloaded. For editable comboboxes, the function clearEditText() is provided, to clear the displayed string without changing the combobox's contents.

There are two signals emitted if the current item of a combobox changes, currentIndexChanged() and activated(). currentIndexChanged() is always emitted regardless if the change was done programmatically or by user interaction, while activated() is only emitted when the change is caused by user interaction. The highlighted() signal is emitted when the user highlights an item in the combobox popup list. All three signals exist in two versions, one with a QString argument and one with an int argument. If the user selects or highlights a pixmap, only the int signals are emitted. Whenever the text of an editable combobox is changed the editTextChanged() signal is emitted.

When the user enters a new string in an editable combobox, the widget may or may not insert it, and it can insert it in several locations. The default policy is is AtBottom but you can change this using setInsertPolicy().

It is possible to constrain the input to an editable combobox using QValidator; see setValidator(). By default, any input is accepted.

A combobox can be populated using the insert functions, insertItem() and insertItems() for example. Items can be changed with setItemText(). An item can be removed with removeItem() and all items can be removed with clear(). The text of the current item is returned by currentText(), and the text of a numbered item is returned with text(). The current item can be set with setCurrentIndex(). The number of items in the combobox is returned by count(); the maximum number of items can be set with setMaxCount(). You can allow editing using setEditable(). For editable comboboxes you can set auto-completion using setCompleter() and whether or not the user can add duplicates is set with setDuplicatesEnabled().

QComboBox uses the model/view framework for its popup list and to store its items. By default a QStandardItemModel stores the items and a QListView subclass displays the popuplist. You can access the model and view directly (with model() and view()), but QComboBox also provides functions to set and get item data (e.g., setItemData() and itemText()). You can also set a new model and view (with setModel() and setView()). For the text and icon in the combobox label, the data in the model that has the Qt::DisplayRole and Qt::DecorationRole is used. Note that you cannot alter the SelectionMode of the view(), e.g., by using setSelectionMode().

Comboboxes in the different built-in styles.

Comboboxes in the different built-in styles.

See also QLineEdit, QSpinBox, QRadioButton, QButtonGroup, and GUI Design Handbook: Combo Box, Drop-Down List Box.

Public Types

Toggle detailsenum QComboBox::

InsertPolicyInsertPolicy { NoInsert , InsertAtTop , InsertAtCurrent , InsertAtBottom , InsertAfterCurrent , InsertBeforeCurrent , InsertAlphabetically , NoInsertion , AtTop , AtCurrent , AtBottom , AfterCurrent , BeforeCurrent InsertBeforeCurrent ...} { NoInsert , InsertAtTop , InsertAtCurrent , InsertAtBottom , InsertAfterCurrent , InsertBeforeCurrent , InsertAlphabetically , NoInsertion , AtTop , AtCurrent , AtBottom , AfterCurrent , BeforeCurrent InsertBeforeCurrent }

This enum specifies what the QComboBox should do when a new string is entered by the user.

ConstantValueDescription
QComboBox::NoInsert 0 The string will not be inserted into the combobox.
QComboBox::InsertAtTop 1 The string will be inserted as the first item in the combobox.
QComboBox::InsertAtCurrent 2 The current item will be replaced by the string.
QComboBox::InsertAtBottom 3 The string will be inserted after the last item in the combobox.
QComboBox::InsertAfterCurrent 4 The string is inserted after the current item in the combobox.
QComboBox::InsertBeforeCurrent 5 The string is inserted before the current item in the combobox.
QComboBox::InsertAlphabetically 6 The string is inserted in the alphabetic order in the combobox.

Look up this member in the source code.

Toggle detailsenum QComboBox::

SizeAdjustPolicySizeAdjustPolicy { AdjustToContents , AdjustToContentsOnFirstShow , AdjustToMinimumContentsLength , AdjustToMinimumContentsLengthWithIcon 3 ...} { AdjustToContents , AdjustToContentsOnFirstShow , AdjustToMinimumContentsLength , AdjustToMinimumContentsLengthWithIcon 3 }

This enum specifies how the size hint of the QComboBox should adjust when new content is added or content changes.

ConstantValueDescription
QComboBox::AdjustToContents 0 The combobox will always adjust to the contents
QComboBox::AdjustToContentsOnFirstShow 1 The combobox will adjust to its contents the first time it is shown.
QComboBox::AdjustToMinimumContentsLength 2 Use AdjustToContents or AdjustToContentsOnFirstShow instead.
QComboBox::AdjustToMinimumContentsLengthWithIcon 3 The combobox will adjust to minimumContentsLength plus space for an icon. For performance reasons use this policy on large models.

Look up this member in the source code.

    Properties

    Obsolete functionObsolete function
    Toggle detailscountcount : const int

    This property holds the number of items in the combobox

    By default, for an empty combo box, this property has a value of 0.

    Access functions:

    Look up this member in the source code.

    Toggle detailscurrentIndexcurrentIndex : int

    This property holds the index of the current item in the combobox.

    The current index can change when inserting or removing items.

    By default, for an empty combo box or a combo box in which no current item is set, this property has a value of -1.

    Access functions:

    Look up this member in the source code.

    Toggle detailscurrentTextcurrentText : const QString

    This property holds the text of the current item

    By default, for an empty combo box or a combo box in which no current item is set, this property contains an empty string.

    Access functions:

    Look up this member in the source code.

    Toggle detailsduplicatesEnabledduplicatesEnabled : bool

    This property holds whether the user can enter duplicate items into the combobox

    Note that it is always possible to programmatically insert duplicate items into the combobox.

    By default, this property is false (duplicates are not allowed).

    Access functions:

    Look up this member in the source code.

    Toggle detailseditableeditable : bool

    This property holds whether the combo box can be edited by the user

    By default, this property is false.

    Access functions:

    Look up this member in the source code.

    Toggle detailsframeframe : bool

    This property holds whether the combo box draws itself with a frame

    If enabled (the default) the combo box draws itself inside a frame, otherwise the combo box draws itself without any frame.

    Access functions:

    Look up this member in the source code.

    Toggle detailsiconSizeiconSize : QSize

    This property holds the size of the icons shown in the combobox.

    Unless explicitly set this returns the default value of the current style. This size is the maximum size that icons can have; icons of smaller size are not scaled up.

    Access functions:

    Look up this member in the source code.

    Toggle detailsinsertPolicyinsertPolicy : InsertPolicy

    This property holds the policy used to determine where user-inserted items should appear in the combobox

    The default value is AtBottom, indicating that new items will appear at the bottom of the list of items.

    See also InsertPolicy.

    Access functions:

    Look up this member in the source code.

    Toggle detailsmaxCountmaxCount : int

    This property holds the maximum number of items allowed in the combobox

    Note: If you set the maximum number to be less then the current amount of items in the combobox, the extra items will be truncated. This also applies if you have set an external model on the combobox.

    By default, this property's value is derived from the highest signed integer available (typically 2147483647).

    Access functions:

    Look up this member in the source code.

    Toggle detailsmaxVisibleItemsmaxVisibleItems : int

    This property holds the maximum allowed size on screen of the combo box, measured in items

    By default, this property has a value of 10.

    Note: This property is ignored for non-editable comboboxes in styles that returns false for QStyle::SH_ComboBox_Popup such as the Mac style or the Gtk+ Style.

    Access functions:

    Look up this member in the source code.

    Toggle detailsminimumContentsLengthminimumContentsLength : int

    This property holds the minimum number of characters that should fit into the combobox.

    The default value is 0.

    If this property is set to a positive value, the minimumSizeHint() and sizeHint() take it into account.

    See also sizeAdjustPolicy.

    Access functions:

    Look up this member in the source code.

    Toggle detailsmodelColumnmodelColumn : int

    This property holds the column in the model that is visible.

    If set prior to populating the combo box, the pop-up view will not be affected and will show the first column (using this property's default value).

    By default, this property has a value of 0.

    Access functions:

    Look up this member in the source code.

    Toggle detailssizeAdjustPolicysizeAdjustPolicy : SizeAdjustPolicy

    This property holds the policy describing how the size of the combobox changes when the content changes

    The default value is AdjustToContentsOnFirstShow.

    See also SizeAdjustPolicy.

    Access functions:

    Look up this member in the source code.

    Toggle detailsautoCompletionautoCompletion : bool

    This property holds whether the combobox provides auto-completion for editable items

    Use setCompleter() instead.

    By default, this property is true.

    See also editable.

    Access functions:

      Look up this member in the source code.

      Toggle detailsautoCompletionCaseSensitivityautoCompletionCaseSensitivity : Qt::CaseSensitivity

      This property holds whether string comparisons are case-sensitive or case-insensitive for auto-completion

      By default, this property is Qt::CaseInsensitive.

      Use setCompleter() instead. Case sensitivity of the auto completion can be changed using QCompleter::setCaseSensitivity().

      See also autoCompletion.

      Access functions:

        Look up this member in the source code.

        Public Functions

        Toggle details QComboBox

        QComboBoxQComboBox ( QWidget *parent=0 ) ( QWidget *parent=0 )

        Constructs a combobox with the given parent, using the default model QStandardItemModel.

        Look up this member in the source code.

        Toggle details QComboBox

        ~QComboBox~QComboBox () ()

        Destroys the combobox.

        Look up this member in the source code.

        Toggle details void QComboBox

        addItemaddItem ( const QString &text , const QVariant &userData=QVariant() ...) ( const QString &text , const QVariant &userData=QVariant() )

        Adds an item to the combobox with the given text, and containing the specified userData (stored in the Qt::UserRole). The item is appended to the list of existing items.

        Look up this member in the source code.

        Toggle details void QComboBox

        addItemaddItem ( const QIcon &icon , const QString &text , const QVariant &userData=QVariant() ...) ( const QIcon &icon , const QString &text , const QVariant &userData=QVariant() )

        Adds an item to the combobox with the given icon and text, and containing the specified userData (stored in the Qt::UserRole). The item is appended to the list of existing items.

        Look up this member in the source code.

        Toggle details void QComboBox

        addItemsaddItems ( const QStringList &texts ) ( const QStringList &texts )

        Adds each of the strings in the given texts to the combobox. Each item is appended to the list of existing items in turn.

        Look up this member in the source code.

        Toggle details void QComboBox

        changeEventchangeEvent ( QEvent *e ) ( QEvent *e ) [virtual protected]

        Reimplemented from QWidget::changeEvent().

        Look up this member in the source code.

        Toggle details QCompleter * QComboBox

        completercompleter () ()const

        Returns the completer that is used to auto complete text input for the combobox.

        See also setCompleter() and editable.

        Look up this member in the source code.

        Toggle details void QComboBox

        contextMenuEventcontextMenuEvent ( QContextMenuEvent *e ) ( QContextMenuEvent *e ) [virtual protected]

        Reimplemented from QWidget::contextMenuEvent().

        Look up this member in the source code.

        Toggle details bool QComboBox

        eventevent ( QEvent *event ) ( QEvent *event ) [virtual]

        Reimplemented from QObject::event().

        Look up this member in the source code.

        Toggle details int QComboBox

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

        Returns the index of the item containing the given data for the given role; otherwise returns -1.

        The flags specify how the items in the combobox are searched.

        Look up this member in the source code.

        Toggle details int QComboBox

        findTextfindText ( const QString &text , Qt::MatchFlags flags=static_cast<Qt::MatchFlags> ( Qt::MatchExactly | Qt::MatchCaseSensitive ) ...) ( const QString &text , Qt::MatchFlags flags=static_cast<Qt::MatchFlags> ( Qt::MatchExactly | Qt::MatchCaseSensitive ) )const

        Returns the index of the item containing the given text; otherwise returns -1.

        The flags specify how the items in the combobox are searched.

        Look up this member in the source code.

        Toggle details void QComboBox

        focusInEventfocusInEvent ( QFocusEvent *e ) ( QFocusEvent *e ) [virtual protected]

        Reimplemented from QWidget::focusInEvent().

        Look up this member in the source code.

        Toggle details void QComboBox

        focusOutEventfocusOutEvent ( QFocusEvent *e ) ( QFocusEvent *e ) [virtual protected]

        Reimplemented from QWidget::focusOutEvent().

        Look up this member in the source code.

        Toggle details void QComboBox

        hideEventhideEvent ( QHideEvent *e ) ( QHideEvent *e ) [virtual protected]

        Reimplemented from QWidget::hideEvent().

        Look up this member in the source code.

        Toggle details void QComboBox

        hidePopuphidePopup () () [virtual]

        Hides the list of items in the combobox if it is currently visible and resets the internal state, so that if the custom pop-up was shown inside the reimplemented showPopup(), then you also need to reimplement the hidePopup() function to hide your custom pop-up and call the base class implementation to reset the internal state whenever your custom pop-up widget is hidden.

        See also showPopup().

        Look up this member in the source code.

        Toggle details void QComboBox

        initStyleOptioninitStyleOption ( QStyleOptionComboBox *option ( QStyleOptionComboBox *option )const[protected]

        Initialize option with the values from this QComboBox. This method is useful for subclasses when they need a QStyleOptionComboBox, but don't want to fill in all the information themselves.

        See also QStyleOption::initFrom().

        Look up this member in the source code.

        Toggle details void QComboBox

        inputMethodEventinputMethodEvent ( QInputMethodEvent *e ) ( QInputMethodEvent *e ) [virtual protected]

        Reimplemented from QWidget::inputMethodEvent().

        Look up this member in the source code.

        Toggle details QVariant QComboBox

        inputMethodQueryinputMethodQuery ( Qt::InputMethodQuery query ...) ( Qt::InputMethodQuery query )const [virtual protected]

        Reimplemented from QWidget::inputMethodQuery().

        Look up this member in the source code.

        Toggle details void QComboBox

        insertIteminsertItem ( int index , const QString &text , const QVariant &userData=QVariant() ...) ( int index , const QString &text , const QVariant &userData=QVariant() )

        Inserts the text and userData (stored in the Qt::UserRole) into the combobox at the given index.

        If the index is equal to or higher than the total number of items, the new item is appended to the list of existing items. If the index is zero or negative, the new item is prepended to the list of existing items.

        See also insertItems().

        Look up this member in the source code.

        Toggle details void QComboBox

        insertIteminsertItem ( int index , const QIcon &icon , const QString &text , const QVariant &userData=QVariant() ...) ( int index , const QIcon &icon , const QString &text , const QVariant &userData=QVariant() )

        Inserts the icon, text and userData (stored in the Qt::UserRole) into the combobox at the given index.

        If the index is equal to or higher than the total number of items, the new item is appended to the list of existing items. If the index is zero or negative, the new item is prepended to the list of existing items.

        See also insertItems().

        Look up this member in the source code.

        Toggle details void QComboBox

        insertItemsinsertItems ( int index , const QStringList &list ...) ( int index , const QStringList &list )

        Inserts the strings from the list into the combobox as separate items, starting at the index specified.

        If the index is equal to or higher than the total number of items, the new items are appended to the list of existing items. If the index is zero or negative, the new items are prepended to the list of existing items.

        See also insertItem().

        Look up this member in the source code.

        Toggle details void QComboBox

        insertSeparatorinsertSeparator ( int index ) ( int index )

        Inserts a separator item into the combobox at the given index.

        If the index is equal to or higher than the total number of items, the new item is appended to the list of existing items. If the index is zero or negative, the new item is prepended to the list of existing items.

        See also insertItem().

        Look up this member in the source code.

        Toggle details QVariant QComboBox

        itemDataitemData ( int index , int role=Qt::UserRole ...) ( int index , int role=Qt::UserRole )const

        Returns the data for the given role in the given index in the combobox, or QVariant::Invalid if there is no data for this role.

        See also setItemData().

        Look up this member in the source code.

        Toggle details QAbstractItemDelegate * QComboBox

        itemDelegateitemDelegate () ()const

        Returns the item delegate used by the popup list view.

        See also setItemDelegate().

        Look up this member in the source code.

        Toggle details QIcon QComboBox

        itemIconitemIcon ( int index ) ( int index )const

        Returns the icon for the given index in the combobox.

        See also setItemIcon().

        Look up this member in the source code.

        Toggle details QString QComboBox

        itemTextitemText ( int index ) ( int index )const

        Returns the text for the given index in the combobox.

        See also setItemText().

        Look up this member in the source code.

        Toggle details void QComboBox

        keyPressEventkeyPressEvent ( QKeyEvent *e ) ( QKeyEvent *e ) [virtual protected]

        Reimplemented from QWidget::keyPressEvent().

        Look up this member in the source code.

        Toggle details void QComboBox

        keyReleaseEventkeyReleaseEvent ( QKeyEvent *e ) ( QKeyEvent *e ) [virtual protected]

        Reimplemented from QWidget::keyReleaseEvent().

        Look up this member in the source code.

        Toggle details QLineEdit * QComboBox

        lineEditlineEdit () ()const

        Returns the line edit used to edit items in the combobox, or 0 if there is no line edit.

        Only editable combo boxes have a line edit.

        See also setLineEdit().

        Look up this member in the source code.

        Toggle details QSize QComboBox

        minimumSizeHintminimumSizeHint () ()const [virtual]

        Reimplemented from QWidget::minimumSizeHint().

        Look up this member in the source code.

        Toggle details QAbstractItemModel * QComboBox

        modelmodel () ()const

        Returns the model used by the combobox.

        See also setModel().

        Look up this member in the source code.

        Toggle details void QComboBox

        mousePressEventmousePressEvent ( QMouseEvent *e ) ( QMouseEvent *e ) [virtual protected]

        Reimplemented from QWidget::mousePressEvent().

        Look up this member in the source code.

        Toggle details void QComboBox

        mouseReleaseEventmouseReleaseEvent ( QMouseEvent *e ) ( QMouseEvent *e ) [virtual protected]

        Reimplemented from QWidget::mouseReleaseEvent().

        Look up this member in the source code.

        Toggle details void QComboBox

        paintEventpaintEvent ( QPaintEvent *e ) ( QPaintEvent *e ) [virtual protected]

        Reimplemented from QWidget::paintEvent().

        Look up this member in the source code.

        Toggle details void QComboBox

        removeItemremoveItem ( int index ) ( int index )

        Removes the item at the given index from the combobox. This will update the current index if the index is removed.

        This function does nothing if index is out of range.

        Look up this member in the source code.

        Toggle details void QComboBox

        resizeEventresizeEvent ( QResizeEvent *e ) ( QResizeEvent *e ) [virtual protected]

        Reimplemented from QWidget::resizeEvent().

        Look up this member in the source code.

        Toggle details QModelIndex QComboBox

        rootModelIndexrootModelIndex () ()const

        Returns the root model item index for the items in the combobox.

        See also setRootModelIndex().

        Look up this member in the source code.

        Toggle details void QComboBox

        setCompletersetCompleter ( QCompleter *completer ) ( QCompleter *completer )

        Sets the completer to use instead of the current completer. If completer is 0, auto completion is disabled.

        By default, for an editable combo box, a QCompleter that performs case insensitive inline completion is automatically created.

        See also completer().

        Look up this member in the source code.

        Toggle details void QComboBox

        setItemDatasetItemData ( int index , const QVariant &value , int role=Qt::UserRole ...) ( int index , const QVariant &value , int role=Qt::UserRole )

        Sets the data role for the item on the given index in the combobox to the specified value.

        See also itemData().

        Look up this member in the source code.

        Toggle details void QComboBox

        setItemDelegatesetItemDelegate ( QAbstractItemDelegate *delegate ...) ( QAbstractItemDelegate *delegate )

        Sets the item delegate for the popup list view. The combobox takes ownership of the delegate.

        Warning: You should not share the same instance of a delegate between comboboxes, widget mappers or views. Doing so can cause incorrect or unintuitive editing behavior since each view connected to a given delegate may receive the closeEditor() signal, and attempt to access, modify or close an editor that has already been closed.

        See also itemDelegate().

        Look up this member in the source code.

        Toggle details void QComboBox

        setItemIconsetItemIcon ( int index , const QIcon &icon ) ( int index , const QIcon &icon )

        Sets the icon for the item on the given index in the combobox.

        See also itemIcon().

        Look up this member in the source code.

        Toggle details void QComboBox

        setItemTextsetItemText ( int index , const QString &text ) ( int index , const QString &text )

        Sets the text for the item on the given index in the combobox.

        See also itemText().

        Look up this member in the source code.

        Toggle details void QComboBox

        setLineEditsetLineEdit ( QLineEdit *edit ) ( QLineEdit *edit )

        Sets the line edit to use instead of the current line edit widget.

        The combo box takes ownership of the line edit.

        See also lineEdit().

        Look up this member in the source code.

        Toggle details void QComboBox

        setModelsetModel ( QAbstractItemModel *model ) ( QAbstractItemModel *model )

        Sets the model to be model. model must not be 0. If you want to clear the contents of a model, call clear().

        See also model() and clear().

        Look up this member in the source code.

        Toggle details void QComboBox

        setRootModelIndexsetRootModelIndex ( const QModelIndex &index ) ( const QModelIndex &index )

        Sets the root model item index for the items in the combobox.

        See also rootModelIndex().

        Look up this member in the source code.

        Toggle details void QComboBox

        setValidatorsetValidator ( const QValidator *validator ) ( const QValidator *validator )

        Sets the validator to use instead of the current validator.

        See also validator().

        Look up this member in the source code.

        Toggle details void QComboBox

        setViewsetView ( QAbstractItemView *itemView ) ( QAbstractItemView *itemView )

        Sets the view to be used in the combobox popup to the given itemView. The combobox takes ownership of the view.

        Note: If you want to use the convenience views (like QListWidget, QTableWidget or QTreeWidget), make sure to call setModel() on the combobox with the convenience widgets model before calling this function.

        See also view().

        Look up this member in the source code.

        Toggle details void QComboBox

        showEventshowEvent ( QShowEvent *e ) ( QShowEvent *e ) [virtual protected]

        Reimplemented from QWidget::showEvent().

        Look up this member in the source code.

        Toggle details void QComboBox

        showPopupshowPopup () () [virtual]

        Displays the list of items in the combobox. If the list is empty then the no items will be shown.

        If you reimplement this function to show a custom pop-up, make sure you call hidePopup() to reset the internal state.

        See also hidePopup().

        Look up this member in the source code.

        Toggle details QSize QComboBox

        sizeHintsizeHint () ()const [virtual]

        Reimplemented from QWidget::sizeHint().

        This implementation caches the size hint to avoid resizing when the contents change dynamically. To invalidate the cached value change the sizeAdjustPolicy.

        Look up this member in the source code.

        Toggle details const QValidator * QComboBox

        validatorvalidator () ()const

        Returns the validator that is used to constrain text input for the combobox.

        See also setValidator() and editable.

        Look up this member in the source code.

        Toggle details QAbstractItemView * QComboBox

        viewview () ()const

        Returns the list view used for the combobox popup.

        See also setView().

        Look up this member in the source code.

        Toggle details void QComboBox

        wheelEventwheelEvent ( QWheelEvent *e ) ( QWheelEvent *e ) [virtual protected]

        Reimplemented from QWidget::wheelEvent().

        Look up this member in the source code.

        Toggle details QComboBox

        QComboBoxQComboBox ( QWidget *parent , const char *name ) ( QWidget *parent , const char *name ) Qt3-support

        Use one of the constructors that doesn't take the name argument and then use setObjectName() instead.

        Look up this member in the source code.

        Toggle details QComboBox

        QComboBoxQComboBox ( bool rw , QWidget *parent , const char *name=0 ...) ( bool rw , QWidget *parent , const char *name=0 ) Qt3-support

        Use one of the constructors that doesn't take the name argument and then use setObjectName() instead.

        Look up this member in the source code.

        Toggle details void QComboBox

        changeItemchangeItem ( const QString &text , int index ) ( const QString &text , int index ) Qt3-support

        Use setItemText() instead.

        Look up this member in the source code.

        Toggle details void QComboBox

        changeItemchangeItem ( const QPixmap &pixmap , int index ) ( const QPixmap &pixmap , int index ) Qt3-support

        Use setItemIcon() instead, for example, setItemIcon(index, QIcon(pixmap)).

        Look up this member in the source code.

        Toggle details void QComboBox

        changeItemchangeItem ( const QPixmap &pixmap , const QString &text , int index ...) ( const QPixmap &pixmap , const QString &text , int index ) Qt3-support

        Use setItem() instead, for example, setItem(index, QIcon(pixmap),text).

        Look up this member in the source code.

        Toggle details void QComboBox

        clearEditclearEdit () () Qt3-support

        Use clearEditText() instead.

        Look up this member in the source code.

        Toggle details void QComboBox

        clearValidatorclearValidator () () Qt3-support

        Use setValidator(0) instead.

        Look up this member in the source code.

        Toggle details int QComboBox

        currentItemcurrentItem () ()const Qt3-support

        Use currentIndex() instead.

        See also setCurrentItem().

        Look up this member in the source code.

        Toggle details bool QComboBox

        editableeditable () ()const Qt3-support

        Use isEditable() instead.

        See also setEditable().

        Look up this member in the source code.

        Toggle details void QComboBox

        insertIteminsertItem ( const QString &text , int index=-1 ...) ( const QString &text , int index=-1 ) Qt3-support

        Look up this member in the source code.

        Toggle details void QComboBox

        insertIteminsertItem ( const QPixmap &pixmap , int index=-1 ...) ( const QPixmap &pixmap , int index=-1 ) Qt3-support

        Use an insertItem() function that takes a QIcon instead, for example, insertItem(index, QIcon(pixmap)).

        Look up this member in the source code.

        Toggle details void QComboBox

        insertIteminsertItem ( const QPixmap &pixmap , const QString &text , int index=-1 ...) ( const QPixmap &pixmap , const QString &text , int index=-1 ) Qt3-support

        Use an insertItem() function that takes a QIcon instead, for example, insertItem(index, QIcon(pixmap), text).

        See also insertItems().

        Look up this member in the source code.

        Toggle details void QComboBox

        insertStringListinsertStringList ( const QStringList &list , int index=-1 ...) ( const QStringList &list , int index=-1 ) Qt3-support

        Use insertItems() instead.

        Look up this member in the source code.

        Toggle details InsertPolicy QComboBox

        insertionPolicyinsertionPolicy () ()const Qt3-support

        Use QComboBox::insertPolicy instead.

        See also setInsertionPolicy().

        Look up this member in the source code.

        Toggle details QPixmap QComboBox

        pixmappixmap ( int index ) ( int index )const Qt3-support

        Use itemIcon() instead.

        Look up this member in the source code.

        Toggle details void QComboBox

        popuppopup () () Qt3-support

        Use showPopup() instead.

        Look up this member in the source code.

        Toggle details void QComboBox

        setCurrentItemsetCurrentItem ( int index ) ( int index ) Qt3-support

        Use setCurrentIndex(int) instead.

        See also currentItem().

        Look up this member in the source code.

        Toggle details void QComboBox

        setCurrentTextsetCurrentText ( const QString &text ) ( const QString &text ) Qt3-support

        Use setItemText() instead.

        See also currentText() and currentIndex().

        Look up this member in the source code.

        Toggle details void QComboBox

        setInsertionPolicysetInsertionPolicy ( InsertPolicy policy ) ( InsertPolicy policy ) Qt3-support

        Use QComboBox::insertPolicy instead.

        See also insertionPolicy().

        Look up this member in the source code.

        Toggle details QString QComboBox

        texttext ( int index ) ( int index )const Qt3-support

        Use itemText() instead.

        Look up this member in the source code.

        Signals

        Toggle details void QComboBox

        activatedactivated ( int index ) ( int index ) [signal]

        This signal is sent when the user chooses an item in the combobox. The item's index is passed. Note that this signal is sent even when the choice is not changed. If you need to know when the choice actually changes, use signal currentIndexChanged().

        Look up this member in the source code.

        Toggle details void QComboBox

        activatedactivated ( const QString &text ) ( const QString &text ) [signal]

        This signal is sent when the user chooses an item in the combobox. The item's text is passed. Note that this signal is sent even when the choice is not changed. If you need to know when the choice actually changes, use signal currentIndexChanged().

        Look up this member in the source code.

        Toggle details void QComboBox

        currentIndexChangedcurrentIndexChanged ( int index ) ( int index ) [signal]

        This signal is sent whenever the currentIndex in the combobox changes either through user interaction or programmatically. The item's index is passed or -1 if the combobox becomes empty or the currentIndex was reset.

        Look up this member in the source code.

        Toggle details void QComboBox

        currentIndexChangedcurrentIndexChanged ( const QString &text ) ( const QString &text ) [signal]

        This signal is sent whenever the currentIndex in the combobox changes either through user interaction or programmatically. The item's text is passed.

        Look up this member in the source code.

        Toggle details void QComboBox

        editTextChangededitTextChanged ( const QString &text ) ( const QString &text ) [signal]

        This signal is emitted when the text in the combobox's line edit widget is changed. The new text is specified by text.

        Look up this member in the source code.

        Toggle details void QComboBox

        highlightedhighlighted ( int index ) ( int index ) [signal]

        This signal is sent when an item in the combobox popup list is highlighted by the user. The item's index is passed.

        Look up this member in the source code.

        Toggle details void QComboBox

        highlightedhighlighted ( const QString &text ) ( const QString &text ) [signal]

        This signal is sent when an item in the combobox popup list is highlighted by the user. The item's text is passed.

        Look up this member in the source code.

        Toggle details void QComboBox

        textChangedtextChanged ( const QString &text ) ( const QString &text ) [signal] Qt3-support

        Use the editTextChanged(const QString &text) signal instead.

        Look up this member in the source code.

        Public Slots

        Toggle details void QComboBox

        clearclear () () [slot]

        Clears the combobox, removing all items.

        Note: If you have set an external model on the combobox this model will still be cleared when calling this function.

        Look up this member in the source code.

        Toggle details void QComboBox

        clearEditTextclearEditText () () [slot]

        Clears the contents of the line edit used for editing in the combobox.

        Look up this member in the source code.

        Toggle details void QComboBox

        setEditTextsetEditText ( const QString &text ) ( const QString &text ) [slot]

        Sets the text in the combobox's text edit.

        Look up this member in the source code.

        Notes provided by the Qt Community

        No notes