QtBase
v6.3.1
|
The QComboBox widget is a combined button and popup list. More...
#include <qcombobox.h>
Public Types | |
enum | InsertPolicy { NoInsert , InsertAtTop , InsertAtCurrent , InsertAtBottom , InsertAfterCurrent , InsertBeforeCurrent , InsertAlphabetically } |
enum | SizeAdjustPolicy { AdjustToContents , AdjustToContentsOnFirstShow , AdjustToMinimumContentsLengthWithIcon } |
Public Types inherited from QWidget | |
enum | RenderFlag { DrawWindowBackground = 0x1 , DrawChildren = 0x2 , IgnoreMask = 0x4 } |
Public Types inherited from QPaintDevice | |
enum | PaintDeviceMetric { PdmWidth = 1 , PdmHeight , PdmWidthMM , PdmHeightMM , PdmNumColors , PdmDepth , PdmDpiX , PdmDpiY , PdmPhysicalDpiX , PdmPhysicalDpiY , PdmDevicePixelRatio , PdmDevicePixelRatioScaled } |
Public Slots | |
void | clear () |
void | clearEditText () |
void | setEditText (const QString &text) |
void | setCurrentIndex (int index) |
void | setCurrentText (const QString &text) |
Public Slots inherited from QWidget | |
void | setEnabled (bool) |
void | setDisabled (bool) |
void | setWindowModified (bool) |
void | setWindowTitle (const QString &) |
void | setStyleSheet (const QString &styleSheet) |
void | setFocus () |
void | update () |
void | repaint () |
virtual void | setVisible (bool visible) |
void | setHidden (bool hidden) |
void | show () |
void | hide () |
void | showMinimized () |
void | showMaximized () |
void | showFullScreen () |
void | showNormal () |
bool | close () |
void | raise () |
void | lower () |
Public Slots inherited from QObject | |
void | deleteLater () |
Signals | |
void | editTextChanged (const QString &) |
void | activated (int index) |
void | textActivated (const QString &) |
void | highlighted (int index) |
void | textHighlighted (const QString &) |
void | currentIndexChanged (int index) |
void | currentTextChanged (const QString &) |
Signals inherited from QWidget | |
void | windowTitleChanged (const QString &title) |
void | windowIconChanged (const QIcon &icon) |
void | windowIconTextChanged (const QString &iconText) |
void | customContextMenuRequested (const QPoint &pos) |
Signals inherited from QObject | |
void | destroyed (QObject *=nullptr) |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
Properties | |
bool | editable |
whether the combo box can be edited by the user More... | |
int | count |
the number of items in the combobox More... | |
QString | currentText |
the current text More... | |
int | currentIndex |
the index of the current item in the combobox. More... | |
QVariant | currentData |
the data for the current item More... | |
int | maxVisibleItems |
the maximum allowed size on screen of the combo box, measured in items More... | |
int | maxCount |
the maximum number of items allowed in the combobox More... | |
InsertPolicy | insertPolicy |
the policy used to determine where user-inserted items should appear in the combobox More... | |
SizeAdjustPolicy | sizeAdjustPolicy |
the policy describing how the size of the combobox changes when the content changes More... | |
int | minimumContentsLength |
the minimum number of characters that should fit into the combobox. More... | |
QSize | iconSize |
the size of the icons shown in the combobox. More... | |
QString | placeholderText |
Sets a placeholderText text shown when no valid index is set. More... | |
bool | duplicatesEnabled |
whether the user can enter duplicate items into the combobox More... | |
bool | frame |
whether the combo box draws itself with a frame More... | |
int | modelColumn |
the column in the model that is visible. More... | |
Properties inherited from QWidget | |
bool | modal |
whether the widget is a modal widget More... | |
Qt::WindowModality | windowModality |
which windows are blocked by the modal widget More... | |
bool | enabled |
whether the widget is enabled More... | |
QRect | geometry |
the geometry of the widget relative to its parent and excluding the window frame More... | |
QRect | frameGeometry |
geometry of the widget relative to its parent including any window frame More... | |
QRect | normalGeometry |
the geometry of the widget as it will appear when shown as a normal (not maximized or full screen) top-level widget More... | |
int | x |
the x coordinate of the widget relative to its parent including any window frame More... | |
int | y |
the y coordinate of the widget relative to its parent and including any window frame More... | |
QPoint | pos |
the position of the widget within its parent widget More... | |
QSize | frameSize |
the size of the widget including any window frame More... | |
QSize | size |
the size of the widget excluding any window frame More... | |
int | width |
the width of the widget excluding any window frame More... | |
int | height |
the height of the widget excluding any window frame More... | |
QRect | rect |
the internal geometry of the widget excluding any window frame More... | |
QRect | childrenRect |
the bounding rectangle of the widget's children More... | |
QRegion | childrenRegion |
the combined region occupied by the widget's children More... | |
QSizePolicy | sizePolicy |
the default layout behavior of the widget More... | |
QSize | minimumSize |
the widget's minimum size More... | |
QSize | maximumSize |
the widget's maximum size in pixels More... | |
int | minimumWidth |
the widget's minimum width in pixels More... | |
int | minimumHeight |
the widget's minimum height in pixels More... | |
int | maximumWidth |
the widget's maximum width in pixels More... | |
int | maximumHeight |
the widget's maximum height in pixels More... | |
QSize | sizeIncrement |
the size increment of the widget More... | |
QSize | baseSize |
the base size of the widget More... | |
QPalette | palette |
the widget's palette More... | |
QFont | font |
the font currently set for the widget More... | |
QCursor | cursor |
the cursor shape for this widget More... | |
bool | mouseTracking |
whether mouse tracking is enabled for the widget More... | |
bool | tabletTracking |
whether tablet tracking is enabled for the widget More... | |
bool | isActiveWindow |
whether this widget's window is the active window More... | |
Qt::FocusPolicy | focusPolicy |
the way the widget accepts keyboard focus More... | |
bool | focus |
whether this widget (or its focus proxy) has the keyboard input focus More... | |
Qt::ContextMenuPolicy | contextMenuPolicy |
how the widget shows a context menu More... | |
bool | updatesEnabled |
whether updates are enabled More... | |
bool | visible |
whether the widget is visible More... | |
bool | minimized |
whether this widget is minimized (iconified) More... | |
bool | maximized |
whether this widget is maximized More... | |
bool | fullScreen |
whether the widget is shown in full screen mode More... | |
QSize | sizeHint |
the recommended size for the widget More... | |
QSize | minimumSizeHint |
the recommended minimum size for the widget More... | |
bool | acceptDrops |
whether drop events are enabled for this widget More... | |
QString | windowTitle |
the window title (caption) More... | |
QIcon | windowIcon |
the widget's icon More... | |
QString | windowIconText |
the text to be displayed on the icon of a minimized window More... | |
double | windowOpacity |
The level of opacity for the window. More... | |
bool | windowModified |
whether the document shown in the window has unsaved changes More... | |
QString | accessibleName |
the widget's name as seen by assistive technologies More... | |
QString | accessibleDescription |
the widget's description as seen by assistive technologies More... | |
Qt::LayoutDirection | layoutDirection |
the layout direction for this widget. More... | |
bool | autoFillBackground |
whether the widget background is filled automatically More... | |
QString | styleSheet |
the widget's style sheet More... | |
QLocale | locale |
the widget's locale More... | |
QString | windowFilePath |
the file path associated with a widget More... | |
Qt::InputMethodHints | inputMethodHints |
What input method specific hints the widget has. More... | |
Properties inherited from QObject | |
QString | objectName |
the name of this object More... | |
The QComboBox widget is a combined button and popup list.
\inmodule QtWidgets
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 three signals emitted if the current item of a combobox changes, currentIndexChanged(), currentTextChanged() and activated(). currentIndexChanged() and currentTextChanged() are 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 \l InsertAtBottom 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 \l{Model/View Programming}{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 \l{QAbstractItemView::}{SelectionMode} of the view(), e.g., by using \l{QAbstractItemView::}{setSelectionMode()}.
Definition at line 59 of file qcombobox.h.
This enum specifies what the QComboBox should do when a new string is entered by the user.
\value NoInsert The string will not be inserted into the combobox. \value InsertAtTop The string will be inserted as the first item in the combobox. \value InsertAtCurrent The current item will be replaced by the string. \value InsertAtBottom The string will be inserted after the last item in the combobox. \value InsertAfterCurrent The string is inserted after the current item in the combobox. \value InsertBeforeCurrent The string is inserted before the current item in the combobox. \value InsertAlphabetically The string is inserted in the alphabetic order in the combobox.
Enumerator | |
---|---|
NoInsert | |
InsertAtTop | |
InsertAtCurrent | |
InsertAtBottom | |
InsertAfterCurrent | |
InsertBeforeCurrent | |
InsertAlphabetically |
Definition at line 103 of file qcombobox.h.
This enum specifies how the size hint of the QComboBox should adjust when new content is added or content changes.
\value AdjustToContents The combobox will always adjust to the contents \value AdjustToContentsOnFirstShow The combobox will adjust to its contents the first time it is shown. \value AdjustToMinimumContentsLengthWithIcon The combobox will adjust to \l minimumContentsLength plus space for an icon. For performance reasons use this policy on large models.
Enumerator | |
---|---|
AdjustToContents | |
AdjustToContentsOnFirstShow | |
AdjustToMinimumContentsLengthWithIcon |
Definition at line 117 of file qcombobox.h.
Constructs a combobox with the given parent, using the default model QStandardItemModel.
Definition at line 958 of file qcombobox.cpp.
QComboBox::~QComboBox | ( | ) |
Destroys the combobox.
Definition at line 1442 of file qcombobox.cpp.
|
protected |
Definition at line 968 of file qcombobox.cpp.
|
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() or currentTextChanged().
|
inline |
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.
Definition at line 262 of file qcombobox.h.
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.
Definition at line 260 of file qcombobox.h.
|
inline |
Adds each of the strings in the given texts to the combobox. Each item is appended to the list of existing items in turn.
Definition at line 171 of file qcombobox.h.
\reimp
Reimplemented from QWidget.
Definition at line 2967 of file qcombobox.cpp.
|
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.
Definition at line 2901 of file qcombobox.cpp.
|
slot |
Clears the contents of the line edit used for editing in the combobox.
Definition at line 2914 of file qcombobox.cpp.
|
overrideprotectedvirtual |
int QComboBox::count | ( | ) | const |
Definition at line 1487 of file qcombobox.cpp.
QVariant QComboBox::currentData | ( | int | role = Qt::UserRole | ) | const |
Definition at line 2211 of file qcombobox.cpp.
int QComboBox::currentIndex | ( | ) | const |
Definition at line 2127 of file qcombobox.cpp.
|
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.
QString QComboBox::currentText | ( | ) | const |
Definition at line 2193 of file qcombobox.cpp.
This signal is sent whenever currentText changes. The new value is passed as text.
bool QComboBox::duplicatesEnabled | ( | ) | const |
Definition at line 1535 of file qcombobox.cpp.
This signal is emitted when the text in the combobox's line edit widget is changed. The new text is specified by text.
|
overridevirtual |
\reimp
Reimplemented from QWidget.
Reimplemented in QFontComboBox.
Definition at line 3077 of file qcombobox.cpp.
int QComboBox::findData | ( | 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.
Definition at line 1561 of file qcombobox.cpp.
|
inline |
Returns the index of the item containing the given text; otherwise returns -1.
The flags specify how the items in the combobox are searched.
Definition at line 97 of file qcombobox.h.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Definition at line 2942 of file qcombobox.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Definition at line 2958 of file qcombobox.cpp.
bool QComboBox::hasFrame | ( | ) | const |
Definition at line 3482 of file qcombobox.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Definition at line 3069 of file qcombobox.cpp.
|
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.
Definition at line 2836 of file qcombobox.cpp.
|
signal |
This signal is sent when an item in the combobox popup list is highlighted by the user. The item's index is passed.
QSize QComboBox::iconSize | ( | ) | const |
|
protectedvirtual |
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.
Definition at line 1226 of file qcombobox.cpp.
|
overrideprotectedvirtual |
QVariant QComboBox::inputMethodQuery | ( | Qt::InputMethodQuery | query, |
const QVariant & | argument | ||
) | const |
|
overridevirtual |
\reimp
Reimplemented from QWidget.
Definition at line 3425 of file qcombobox.cpp.
void QComboBox::insertItem | ( | 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.
Definition at line 2274 of file qcombobox.cpp.
|
inline |
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.
Definition at line 266 of file qcombobox.h.
void QComboBox::insertItems | ( | 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.
Definition at line 2325 of file qcombobox.cpp.
QComboBox::InsertPolicy QComboBox::insertPolicy | ( | ) | const |
Definition at line 1582 of file qcombobox.cpp.
void QComboBox::insertSeparator | ( | 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.
Definition at line 2374 of file qcombobox.cpp.
bool QComboBox::isEditable | ( | ) | const |
QVariant QComboBox::itemData | ( | int | index, |
int | role = Qt::UserRole |
||
) | const |
Returns the data for the given role in the given index in the combobox, or an invalid QVariant if there is no data for this role.
Definition at line 2241 of file qcombobox.cpp.
QAbstractItemDelegate * QComboBox::itemDelegate | ( | ) | const |
Returns the item delegate used by the popup list view.
Definition at line 1970 of file qcombobox.cpp.
QIcon QComboBox::itemIcon | ( | int | index | ) | const |
Returns the icon for the given index in the combobox.
Definition at line 2230 of file qcombobox.cpp.
QString QComboBox::itemText | ( | int | index | ) | const |
Returns the text for the given index in the combobox.
Definition at line 2220 of file qcombobox.cpp.
\reimp
Reimplemented from QWidget.
Definition at line 3180 of file qcombobox.cpp.
\reimp
Reimplemented from QWidget.
Definition at line 3323 of file qcombobox.cpp.
QLineEdit * QComboBox::lineEdit | ( | ) | const |
Returns the line edit used to edit items in the combobox, or \nullptr if there is no line edit.
Only editable combo boxes have a line edit.
Definition at line 1884 of file qcombobox.cpp.
int QComboBox::maxCount | ( | ) | const |
Definition at line 1520 of file qcombobox.cpp.
int QComboBox::maxVisibleItems | ( | ) | const |
Definition at line 1464 of file qcombobox.cpp.
int QComboBox::minimumContentsLength | ( | ) | const |
Definition at line 1633 of file qcombobox.cpp.
|
overridevirtual |
QAbstractItemModel * QComboBox::model | ( | ) | const |
Returns the model used by the combobox.
Definition at line 2003 of file qcombobox.cpp.
int QComboBox::modelColumn | ( | ) | const |
Definition at line 3510 of file qcombobox.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Definition at line 3117 of file qcombobox.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Definition at line 3169 of file qcombobox.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Definition at line 3033 of file qcombobox.cpp.
QString QComboBox::placeholderText | ( | ) | const |
Definition at line 1719 of file qcombobox.cpp.
void QComboBox::removeItem | ( | 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.
Definition at line 2391 of file qcombobox.cpp.
|
overrideprotectedvirtual |
QModelIndex QComboBox::rootModelIndex | ( | ) | const |
Returns the root model item index for the items in the combobox.
Definition at line 2097 of file qcombobox.cpp.
|
slot |
void QComboBox::setDuplicatesEnabled | ( | bool | enable | ) |
void QComboBox::setEditable | ( | bool | editable | ) |
Definition at line 1773 of file qcombobox.cpp.
Sets the text in the combobox's text edit.
Definition at line 2928 of file qcombobox.cpp.
void QComboBox::setFrame | ( | bool | enable | ) |
void QComboBox::setInsertPolicy | ( | InsertPolicy | policy | ) |
void QComboBox::setItemData | ( | 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.
Definition at line 2427 of file qcombobox.cpp.
void QComboBox::setItemDelegate | ( | QAbstractItemDelegate * | delegate | ) |
Sets the item delegate for the popup list view. The combobox takes ownership of the delegate.
Any existing delegate will be removed, but not deleted. QComboBox does not take ownership of delegate.
Definition at line 1990 of file qcombobox.cpp.
Sets the icon for the item on the given index in the combobox.
Definition at line 2414 of file qcombobox.cpp.
Sets the text for the item on the given index in the combobox.
Definition at line 2402 of file qcombobox.cpp.
Sets the line edit to use instead of the current line edit widget.
The combo box takes ownership of the line edit.
Definition at line 1816 of file qcombobox.cpp.
void QComboBox::setMaxCount | ( | int | max | ) |
Definition at line 1505 of file qcombobox.cpp.
void QComboBox::setMaxVisibleItems | ( | int | maxItems | ) |
Definition at line 1470 of file qcombobox.cpp.
void QComboBox::setMinimumContentsLength | ( | int | characters | ) |
|
virtual |
Sets the model to be model. model must not be \nullptr. If you want to clear the contents of a model, call clear().
Definition at line 2022 of file qcombobox.cpp.
void QComboBox::setModelColumn | ( | int | visibleColumn | ) |
Definition at line 3516 of file qcombobox.cpp.
void QComboBox::setRootModelIndex | ( | const QModelIndex & | index | ) |
Sets the root model item index for the items in the combobox.
Definition at line 2108 of file qcombobox.cpp.
void QComboBox::setSizeAdjustPolicy | ( | QComboBox::SizeAdjustPolicy | policy | ) |
Definition at line 1610 of file qcombobox.cpp.
void QComboBox::setValidator | ( | const QValidator * | validator | ) |
Sets the validator to use instead of the current validator.
false
. Definition at line 1899 of file qcombobox.cpp.
void QComboBox::setView | ( | 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.
Definition at line 2454 of file qcombobox.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Definition at line 3055 of file qcombobox.cpp.
|
virtual |
Displays the list of items in the combobox. If the list is empty then 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.
Reimplemented in QFileDialogComboBox.
Definition at line 2580 of file qcombobox.cpp.
QComboBox::SizeAdjustPolicy QComboBox::sizeAdjustPolicy | ( | ) | const |
Definition at line 1604 of file qcombobox.cpp.
|
overridevirtual |
\reimp
This implementation caches the size hint to avoid resizing when the contents change dynamically. To invalidate the cached value change the \l sizeAdjustPolicy.
Reimplemented from QWidget.
Reimplemented in QFontComboBox.
Definition at line 2483 of file qcombobox.cpp.
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() or currentTextChanged().
This signal is sent when an item in the combobox popup list is highlighted by the user. The item's text is passed.
const QValidator * QComboBox::validator | ( | ) | const |
Returns the validator that is used to constrain text input for the combobox.
Definition at line 1912 of file qcombobox.cpp.
QAbstractItemView * QComboBox::view | ( | ) | const |
Returns the list view used for the combobox popup.
Definition at line 2439 of file qcombobox.cpp.
|
read |
the number of items in the combobox
By default, for an empty combo box, this property has a value of 0.
Definition at line 270 of file qcombobox.h.
|
read |
the data for 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 invalid QVariant.
Definition at line 270 of file qcombobox.h.
|
readwrite |
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.
Definition at line 270 of file qcombobox.h.
|
readwrite |
the current text
If the combo box is editable, the current text is the value displayed by the line edit. Otherwise, it is the value of the current item or an empty string if the combo box is empty or no current item is set.
The setter setCurrentText() simply calls setEditText() if the combo box is editable. Otherwise, if there is a matching text in the list, currentIndex is set to the corresponding index.
Definition at line 270 of file qcombobox.h.
|
readwrite |
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).
Definition at line 270 of file qcombobox.h.
|
readwrite |
whether the combo box can be edited by the user
By default, this property is false
. The effect of editing depends on the insert policy.
Definition at line 270 of file qcombobox.h.
|
readwrite |
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.
Definition at line 270 of file qcombobox.h.
|
readwrite |
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.
Definition at line 270 of file qcombobox.h.
|
readwrite |
the policy used to determine where user-inserted items should appear in the combobox
The default value is \l InsertAtBottom, indicating that new items will appear at the bottom of the list of items.
Definition at line 270 of file qcombobox.h.
|
readwrite |
the maximum number of items allowed in the combobox
By default, this property's value is derived from the highest signed integer available (typically 2147483647).
Definition at line 270 of file qcombobox.h.
|
readwrite |
the maximum allowed size on screen of the combo box, measured in items
By default, this property has a value of 10.
Definition at line 270 of file qcombobox.h.
|
readwrite |
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.
Definition at line 270 of file qcombobox.h.
|
readwrite |
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.
Definition at line 270 of file qcombobox.h.
|
readwrite |
Sets a placeholderText text shown when no valid index is set.
The placeholderText will be shown when an invalid index is set. The text is not accessible in the dropdown list. When this function is called before items are added the placeholder text will be shown, otherwise you have to call setCurrentIndex(-1) programmatically if you want to show the placeholder text. Set an empty placeholder text to reset the setting.
When the QComboBox is editable, use QLineEdit::setPlaceholderText() instead.
Definition at line 270 of file qcombobox.h.
|
readwrite |
the policy describing how the size of the combobox changes when the content changes
The default value is \l AdjustToContentsOnFirstShow.
Definition at line 270 of file qcombobox.h.