|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QWidget
com.trolltech.qt.gui.QComboBox
public class QComboBox
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 selectes 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.
Nested Class Summary | |
---|---|
static class |
QComboBox.InsertPolicy
This enum specifies what the QComboBox should do when a new string is entered by the user. |
static class |
QComboBox.SizeAdjustPolicy
This enum specifies how the size hint of the QComboBox should adjust when new content is added or content changes. |
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget |
---|
QWidget.RenderFlag, QWidget.RenderFlags |
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I> |
Field Summary | |
---|---|
QSignalEmitter.Signal1<java.lang.String> |
activated
This signal is sent when an item in the combobox is activated by the user. |
QSignalEmitter.Signal1<java.lang.Integer> |
activatedIndex
This signal is sent when an item in the combobox is activated by the user. |
QSignalEmitter.Signal1<java.lang.Integer> |
currentIndexChanged
This signal is sent whenever the currentIndex in the combobox changes either through user interaction or programmatically. |
QSignalEmitter.Signal1<java.lang.String> |
currentStringChanged
This signal is sent whenever the currentIndex in the combobox changes either through user interaction or programmatically. |
QSignalEmitter.Signal1<java.lang.String> |
editTextChanged
This signal is emitted when the text in the combobox's line edit widget is changed. |
QSignalEmitter.Signal1<java.lang.String> |
highlighted
This signal is sent when an item in the combobox popup list is highlighted by the user. |
QSignalEmitter.Signal1<java.lang.Integer> |
highlightedIndex
This signal is sent when an item in the combobox popup list is highlighted by the user. |
Fields inherited from class com.trolltech.qt.gui.QWidget |
---|
customContextMenuRequested |
Constructor Summary | |
---|---|
QComboBox()
Equivalent to QComboBox(0). |
|
QComboBox(QWidget parent)
Constructs a combobox with the given parent, using the default model QStandardItemModel. |
Method Summary | |
---|---|
void |
addItem(QIcon icon,
java.lang.String text)
Equivalent to addItem(icon, text, QVariant()). |
void |
addItem(QIcon icon,
java.lang.String text,
java.lang.Object userData)
Adds an item to the combobox with the given icon and text, and containing the specified userData. |
void |
addItem(java.lang.String text)
Equivalent to addItem(text, QVariant()). |
void |
addItem(java.lang.String text,
java.lang.Object userData)
Adds an item to the combobox with the given text, and containing the specified userData. |
void |
addItems(java.util.List<java.lang.String> texts)
Adds each of the strings in the given texts to the combobox. |
protected void |
changeEvent(QEvent e)
This function is reimplemented for internal reasons. |
void |
clear()
Clears the combobox, removing all items. |
void |
clearEditText()
Clears the contents of the line edit used for editing in the combobox. |
QCompleter |
completer()
Returns the completer that is used to auto complete text input for the combobox. |
protected void |
contextMenuEvent(QContextMenuEvent e)
This function is reimplemented for internal reasons. |
int |
count()
Returns the number of items in the combobox. |
int |
currentIndex()
Returns the index of the current item in the combobox. |
java.lang.String |
currentText()
Returns the text of the current item. |
boolean |
duplicatesEnabled()
Returns whether the user can enter duplicate items into the combobox. |
boolean |
event(QEvent event)
This function is reimplemented for internal reasons. |
int |
findData(java.lang.Object data)
Equivalent to findData(data, Qt::UserRole, Qt::MatchExactly | Qt::MatchCaseSensitive). |
int |
findData(java.lang.Object data,
int role)
Equivalent to findData(data, role, Qt::MatchExactly | Qt::MatchCaseSensitive). |
int |
findData(java.lang.Object data,
int role,
Qt.MatchFlag... flags)
Returns the index of the item containing the given data for the given role; otherwise returns -1. |
int |
findData(java.lang.Object data,
int role,
Qt.MatchFlags flags)
Returns the index of the item containing the given data for the given role; otherwise returns -1. |
int |
findText(java.lang.String text)
Equivalent to findText(text, Qt::MatchExactly | Qt::MatchCaseSensitive). |
int |
findText(java.lang.String text,
Qt.MatchFlag... flags)
Returns the index of the item containing the given text; otherwise returns -1. |
int |
findText(java.lang.String text,
Qt.MatchFlags flags)
Returns the index of the item containing the given text; otherwise returns -1. |
protected void |
focusInEvent(QFocusEvent e)
This function is reimplemented for internal reasons. |
protected void |
focusOutEvent(QFocusEvent e)
This function is reimplemented for internal reasons. |
static QComboBox |
fromNativePointer(QNativePointer nativePointer)
This function returns the QComboBox instance pointed to by nativePointer |
boolean |
hasFrame()
Returns whether the combo box draws itself with a frame. |
protected void |
hideEvent(QHideEvent e)
This function is reimplemented for internal reasons. |
void |
hidePopup()
Hides the list of items in the combobox if it is currently visible; otherwise this function does nothing. |
QSize |
iconSize()
Returns the size of the icons shown in the combobox.. |
protected void |
initStyleOption(QStyleOptionComboBox option)
Initialize option with the values from this QComboBox. |
protected void |
inputMethodEvent(QInputMethodEvent arg__1)
This function is reimplemented for internal reasons. |
java.lang.Object |
inputMethodQuery(Qt.InputMethodQuery arg__1)
This function is reimplemented for internal reasons. |
void |
insertItem(int index,
QIcon icon,
java.lang.String text)
Equivalent to insertItem(index, icon, text, QVariant()). |
void |
insertItem(int index,
QIcon icon,
java.lang.String text,
java.lang.Object userData)
Inserts the icon, text and userData into the combobox at the given index. |
void |
insertItem(int index,
java.lang.String text)
Equivalent to insertItem(index, text, QVariant()). |
void |
insertItem(int index,
java.lang.String text,
java.lang.Object userData)
Inserts the text and userData into the combobox at the given index. |
void |
insertItems(int index,
java.util.List<java.lang.String> texts)
Inserts the strings from the texts into the combobox as separate items, starting at the index specified. |
QComboBox.InsertPolicy |
insertPolicy()
Returns the policy used to determine where user-inserted items should appear in the combobox. |
boolean |
isEditable()
Returns whether the combobox can be edited by the user. |
java.lang.Object |
itemData(int index)
Equivalent to itemData(index, Qt::UserRole). |
java.lang.Object |
itemData(int index,
int role)
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. |
QAbstractItemDelegate |
itemDelegate()
Returns the item delegate used by the popup list view. |
QIcon |
itemIcon(int index)
Returns the icon for the given index in the combobox. |
java.lang.String |
itemText(int index)
Returns the text for the given index in the combobox. |
protected void |
keyPressEvent(QKeyEvent e)
This function is reimplemented for internal reasons. |
protected void |
keyReleaseEvent(QKeyEvent e)
This function is reimplemented for internal reasons. |
QLineEdit |
lineEdit()
Returns the line edit used to edit items in the combobox, or 0 if there is no line edit. |
int |
maxCount()
Returns the maximum number of items allowed in the combobox. |
int |
maxVisibleItems()
Returns the maximum allowed size on screen of the combobox. |
int |
minimumContentsLength()
Returns the minimum number of characters that should fit into the combobox.. |
QSize |
minimumSizeHint()
This function is reimplemented for internal reasons. |
QAbstractItemModel |
model()
Returns the model used by the combobox. |
int |
modelColumn()
Returns the column in the model that is visible.. |
protected void |
mousePressEvent(QMouseEvent e)
This function is reimplemented for internal reasons. |
protected void |
mouseReleaseEvent(QMouseEvent e)
This function is reimplemented for internal reasons. |
protected void |
paintEvent(QPaintEvent e)
This function is reimplemented for internal reasons. |
void |
removeItem(int index)
Removes the item at the given index from the combobox. |
protected void |
resizeEvent(QResizeEvent e)
This function is reimplemented for internal reasons. |
QModelIndex |
rootModelIndex()
Returns the root model item index for the items in the combobox. |
void |
setCompleter(QCompleter c)
Sets the c to use instead of the current completer. |
void |
setCurrentIndex(int index)
Sets the index of the current item in the combobox. |
void |
setDuplicatesEnabled(boolean enable)
Sets whether the user can enter duplicate items into the combobox to enable. |
void |
setEditable(boolean editable)
Sets whether the combobox can be edited by the user to editable. |
void |
setEditText(java.lang.String text)
Sets the text in the combobox's text edit. |
void |
setFrame(boolean arg__1)
Sets whether the combo box draws itself with a frame to arg__1. |
void |
setIconSize(QSize size)
Sets the size of the icons shown in the combobox. to size. |
void |
setInsertPolicy(QComboBox.InsertPolicy policy)
Sets the policy used to determine where user-inserted items should appear in the combobox to policy. |
void |
setItemData(int index,
java.lang.Object value)
Equivalent to setItemData(index, value, Qt::UserRole). |
void |
setItemData(int index,
java.lang.Object value,
int role)
Sets the data role for the item on the given index in the combobox to the specified value. |
void |
setItemDelegate(QAbstractItemDelegate delegate)
Sets the item delegate for the popup list view. |
void |
setItemIcon(int index,
QIcon icon)
Sets the icon for the item on the given index in the combobox. |
void |
setItemText(int index,
java.lang.String text)
Sets the text for the item on the given index in the combobox. |
void |
setLineEdit(QLineEdit edit)
Sets the line edit to use instead of the current line edit widget. |
void |
setMaxCount(int max)
Sets the maximum number of items allowed in the combobox to max. |
void |
setMaxVisibleItems(int maxItems)
Sets the maximum allowed size on screen of the combobox to maxItems. |
void |
setMinimumContentsLength(int characters)
Sets the minimum number of characters that should fit into the combobox. to characters. |
void |
setModel(QAbstractItemModel model)
Sets the model to be model. |
void |
setModelColumn(int visibleColumn)
Sets the column in the model that is visible. to visibleColumn. |
void |
setRootModelIndex(QModelIndex index)
Sets the root model item index for the items in the combobox. |
void |
setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy policy)
Sets the policy describing how the size of the combobox changes when the content changes to policy. |
void |
setValidator(QValidator v)
Sets the v to use instead of the current validator. |
void |
setView(QAbstractItemView itemView)
Sets the view to be used in the combobox popup to the given itemView. |
protected void |
showEvent(QShowEvent e)
This function is reimplemented for internal reasons. |
void |
showPopup()
Displays the list of items in the combobox. |
QComboBox.SizeAdjustPolicy |
sizeAdjustPolicy()
Returns the policy describing how the size of the combobox changes when the content changes. |
QSize |
sizeHint()
This function is reimplemented for internal reasons. |
QValidator |
validator()
Returns the validator that is used to constrain text input for the combobox. |
QAbstractItemView |
view()
Returns the list view used for the combobox popup. |
protected void |
wheelEvent(QWheelEvent e)
This function is reimplemented for internal reasons. |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
disconnect, disconnect, signalSender |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Field Detail |
---|
public final QSignalEmitter.Signal1<java.lang.Integer> activatedIndex
This signal is sent when an item in the combobox is activated by the user. The item's index is given.
public final QSignalEmitter.Signal1<java.lang.String> activated
This signal is sent when an item in the combobox is activated by the user. The item's arg__1 is given.
public final QSignalEmitter.Signal1<java.lang.Integer> currentIndexChanged
This signal is sent whenever the currentIndex in the combobox changes either through user interaction or programmatically. The item's index is given or -1 if the combobox becomes empty or the currentIndex was reset.
public final QSignalEmitter.Signal1<java.lang.String> currentStringChanged
This signal is sent whenever the currentIndex in the combobox changes either through user interaction or programmatically. The item's arg__1 is given.
public final QSignalEmitter.Signal1<java.lang.String> editTextChanged
This signal is emitted when the text in the combobox's line edit widget is changed. The new text is specified by arg__1.
public final QSignalEmitter.Signal1<java.lang.Integer> highlightedIndex
This signal is sent when an item in the combobox popup list is highlighted by the user. The item's index is given.
public final QSignalEmitter.Signal1<java.lang.String> highlighted
This signal is sent when an item in the combobox popup list is highlighted by the user. The item's arg__1 is given.
Constructor Detail |
---|
public QComboBox()
Equivalent to QComboBox(0).
public QComboBox(QWidget parent)
Constructs a combobox with the given parent, using the default model QStandardItemModel.
Method Detail |
---|
public final void addItem(java.lang.String text)
Equivalent to addItem(text, QVariant()).
public final void addItem(java.lang.String text, java.lang.Object userData)
Adds an item to the combobox with the given text, and containing the specified userData. The item is appended to the list of existing items.
public final void addItem(QIcon icon, java.lang.String text)
Equivalent to addItem(icon, text, QVariant()).
public final void addItem(QIcon icon, java.lang.String text, java.lang.Object userData)
Adds an item to the combobox with the given icon and text, and containing the specified userData. The item is appended to the list of existing items.
public final void addItems(java.util.List<java.lang.String> 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.
public final void clear()
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.
public final void clearEditText()
Clears the contents of the line edit used for editing in the combobox.
public final QCompleter completer()
Returns the completer that is used to auto complete text input for the combobox.
editable
public final int count()
Returns the number of items in the combobox.
public final int currentIndex()
Returns the index of the current item in the combobox. The index can change when inserting or removing items. Returns -1 if no current item is set or the combobox is empty..
public final java.lang.String currentText()
Returns the text of the current item.
public final boolean duplicatesEnabled()
Returns whether the user can enter duplicate items into the combobox.
Note that it is always possible to programmatically insert duplicate items into the combobox.
public final int findData(java.lang.Object data, int role, Qt.MatchFlag... flags)
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.
public final int findData(java.lang.Object data, int role)
Equivalent to findData(data, role, Qt::MatchExactly | Qt::MatchCaseSensitive).
public final int findData(java.lang.Object data)
Equivalent to findData(data, Qt::UserRole, Qt::MatchExactly | Qt::MatchCaseSensitive).
public final int findData(java.lang.Object data, int role, Qt.MatchFlags flags)
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.
public final int findText(java.lang.String text, Qt.MatchFlag... flags)
Returns the index of the item containing the given text; otherwise returns -1.
The flags specify how the items in the combobox are searched.
public final int findText(java.lang.String text)
Equivalent to findText(text, Qt::MatchExactly | Qt::MatchCaseSensitive).
public final int findText(java.lang.String text, Qt.MatchFlags flags)
Returns the index of the item containing the given text; otherwise returns -1.
The flags specify how the items in the combobox are searched.
public final boolean hasFrame()
Returns 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.
public final QSize iconSize()
Returns 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.
public final void insertItem(int index, java.lang.String text)
Equivalent to insertItem(index, text, QVariant()).
public final void insertItem(int index, java.lang.String text, java.lang.Object userData)
Inserts the text and userData 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.
public final void insertItem(int index, QIcon icon, java.lang.String text)
Equivalent to insertItem(index, icon, text, QVariant()).
public final void insertItem(int index, QIcon icon, java.lang.String text, java.lang.Object userData)
Inserts the icon, text and userData 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.
public final void insertItems(int index, java.util.List<java.lang.String> texts)
Inserts the strings from the texts 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.
public final QComboBox.InsertPolicy insertPolicy()
Returns 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.
public final boolean isEditable()
Returns whether the combobox can be edited by the user.
public final java.lang.Object itemData(int index)
Equivalent to itemData(index, Qt::UserRole).
public final java.lang.Object itemData(int index, int role)
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.
public final QAbstractItemDelegate itemDelegate()
Returns the item delegate used by the popup list view.
public final QIcon itemIcon(int index)
Returns the icon for the given index in the combobox.
public final java.lang.String itemText(int index)
Returns the text for the given index in the combobox.
public final QLineEdit lineEdit()
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.
public final int maxCount()
Returns 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.
public final int maxVisibleItems()
Returns the maximum allowed size on screen of the combobox.
This property is ignored for non-editable comboboxes in Mac style.
public final int minimumContentsLength()
Returns 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.
public final QAbstractItemModel model()
Returns the model used by the combobox.
public final int modelColumn()
Returns the column in the model that is visible..
If set prior to populating the combobox, the popup view will not be affected and will show the first column.
public final void removeItem(int index)
Removes the item at the given index from the combobox. This will update the current index if the index is removed.
public final QModelIndex rootModelIndex()
Returns the root model item index for the items in the combobox.
public final void setCompleter(QCompleter c)
Sets the c to use instead of the current completer. If c is 0, auto completion is disabled.
By default, for an editable combo box, a QCompleter that performs case insensitive inline completion is automatically created.
public final void setCurrentIndex(int index)
Sets the index of the current item in the combobox. The index can change when inserting or removing items. Returns -1 if no current item is set or the combobox is empty. to index.
public final void setDuplicatesEnabled(boolean enable)
Sets whether the user can enter duplicate items into the combobox to enable.
Note that it is always possible to programmatically insert duplicate items into the combobox.
public final void setEditText(java.lang.String text)
Sets the text in the combobox's text edit.
public final void setEditable(boolean editable)
Sets whether the combobox can be edited by the user to editable.
public final void setFrame(boolean arg__1)
Sets whether the combo box draws itself with a frame to arg__1.
If enabled (the default) the combo box draws itself inside a frame, otherwise the combo box draws itself without any frame.
public final void setIconSize(QSize size)
Sets the size of the icons shown in the combobox. to size.
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.
public final void setInsertPolicy(QComboBox.InsertPolicy policy)
Sets the policy used to determine where user-inserted items should appear in the combobox to policy.
The default value is AtBottom, indicating that new items will appear at the bottom of the list of items.
public final void setItemData(int index, java.lang.Object value)
Equivalent to setItemData(index, value, Qt::UserRole).
public final void setItemData(int index, java.lang.Object value, int role)
Sets the data role for the item on the given index in the combobox to the specified value.
public final void setItemDelegate(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.
public final void setItemIcon(int index, QIcon icon)
Sets the icon for the item on the given index in the combobox.
public final void setItemText(int index, java.lang.String text)
Sets the text for the item on the given index in the combobox.
public final void setLineEdit(QLineEdit edit)
Sets the line edit to use instead of the current line edit widget.
The combo box takes ownership of the line edit.
public final void setMaxCount(int max)
Sets the maximum number of items allowed in the combobox to max.
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.
public final void setMaxVisibleItems(int maxItems)
Sets the maximum allowed size on screen of the combobox to maxItems.
This property is ignored for non-editable comboboxes in Mac style.
public final void setMinimumContentsLength(int characters)
Sets the minimum number of characters that should fit into the combobox. to characters.
The default value is 0.
If this property is set to a positive value, the minimumSizeHint and sizeHint take it into account.
public final void setModel(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.
public final void setModelColumn(int visibleColumn)
Sets the column in the model that is visible. to visibleColumn.
If set prior to populating the combobox, the popup view will not be affected and will show the first column.
public final void setRootModelIndex(QModelIndex index)
Sets the root model item index for the items in the combobox.
public final void setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy policy)
Sets the policy describing how the size of the combobox changes when the content changes to policy.
The default value is AdjustToContentsOnFirstShow.
public final void setValidator(QValidator v)
Sets the v to use instead of the current validator.
public final void 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.
public final QComboBox.SizeAdjustPolicy sizeAdjustPolicy()
Returns the policy describing how the size of the combobox changes when the content changes.
The default value is AdjustToContentsOnFirstShow.
public final QValidator validator()
Returns the validator that is used to constrain text input for the combobox.
editable
public final QAbstractItemView view()
Returns the list view used for the combobox popup.
protected void changeEvent(QEvent e)
This function is reimplemented for internal reasons.
changeEvent
in class QWidget
protected void contextMenuEvent(QContextMenuEvent e)
This function is reimplemented for internal reasons.
contextMenuEvent
in class QWidget
public boolean event(QEvent event)
This function is reimplemented for internal reasons.
event
in class QWidget
protected void focusInEvent(QFocusEvent e)
This function is reimplemented for internal reasons.
focusInEvent
in class QWidget
protected void focusOutEvent(QFocusEvent e)
This function is reimplemented for internal reasons.
focusOutEvent
in class QWidget
protected void hideEvent(QHideEvent e)
This function is reimplemented for internal reasons.
hideEvent
in class QWidget
visible
,
event,
QHideEventpublic void hidePopup()
Hides the list of items in the combobox if it is currently visible; otherwise this function does nothing.
protected void inputMethodEvent(QInputMethodEvent arg__1)
This function is reimplemented for internal reasons.
inputMethodEvent
in class QWidget
public java.lang.Object inputMethodQuery(Qt.InputMethodQuery arg__1)
This function is reimplemented for internal reasons.
inputMethodQuery
in class QWidget
protected void keyPressEvent(QKeyEvent e)
This function is reimplemented for internal reasons.
keyPressEvent
in class QWidget
protected void keyReleaseEvent(QKeyEvent e)
This function is reimplemented for internal reasons.
keyReleaseEvent
in class QWidget
public QSize minimumSizeHint()
This function is reimplemented for internal reasons.
minimumSizeHint
in class QWidget
protected void mousePressEvent(QMouseEvent e)
This function is reimplemented for internal reasons.
mousePressEvent
in class QWidget
Example
protected void mouseReleaseEvent(QMouseEvent e)
This function is reimplemented for internal reasons.
mouseReleaseEvent
in class QWidget
Example
protected void paintEvent(QPaintEvent e)
This function is reimplemented for internal reasons.
paintEvent
in class QWidget
protected void resizeEvent(QResizeEvent e)
This function is reimplemented for internal reasons.
resizeEvent
in class QWidget
Example
protected void showEvent(QShowEvent e)
This function is reimplemented for internal reasons.
showEvent
in class QWidget
visible
,
event,
QShowEventpublic void showPopup()
Displays the list of items in the combobox. If the list is empty then the no items will be shown.
public QSize sizeHint()
This function is reimplemented for internal reasons.
sizeHint
in class QWidget
protected void wheelEvent(QWheelEvent e)
This function is reimplemented for internal reasons.
wheelEvent
in class QWidget
public static QComboBox fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.protected final void initStyleOption(QStyleOptionComboBox option)
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |