model_combo_box¶
Module Contents¶
Abstract combo box build in data model |
|
Combo box build in data model |
|
Editable combo box build in data model |
- class ModelComboBoxBase(parent=None, **kwargs)¶
Bases:
PyQt5.QtCore.QObjectAbstract combo box build in data model
- currentIndexChanged¶
- currentTextChanged¶
- activated¶
- textActivated¶
- isHover = False¶
- isPressed = False¶
- dropMenu = None¶
- setModel(model: PyQt5.QtCore.QAbstractItemModel)¶
- model() PyQt5.QtCore.QAbstractItemModel¶
- eventFilter(obj, e: PyQt5.QtCore.QEvent)¶
- insertItem(index: int, text: str, userData=None, icon: PyQt5.QtGui.QIcon = None)¶
Inserts item into the combobox at the given index.
- insertItems(index: int, texts: Iterable[str])¶
Inserts items into the combobox, starting at the index specified.
- addItem(text: str, userData=None, icon: PyQt5.QtGui.QIcon = None)¶
add item
Parameters¶
- text: str
the text of item
icon: str | QIcon | FluentIconBase
- removeItem(index: int)¶
Removes the item at the given index from the combobox. This will update the current index if the index is removed.
- currentIndex()¶
- setText(text: str)¶
- currentText()¶
- currentData()¶
- setCurrentText(text)¶
set the current text displayed in combo box, text should be in the item list
Parameters¶
- text: str
text displayed in combo box
- setItemText(index: int, text: str)¶
set the text of item
Parameters¶
- index: int
the index of item
- text: str
new text of item
- itemData(index: int)¶
Returns the data in the given index
- itemText(index: int)¶
Returns the text in the given index
- itemIcon(index: int)¶
Returns the icon in the given index
- setItemData(index: int, value, role=Qt.ItemDataRole.UserRole)¶
- setItemIcon(index: int, icon: str | PyQt5.QtGui.QIcon | qfluentwidgets.common.icon.FluentIconBase)¶
Sets the data role for the item on the given index
- findData(data, role=Qt.ItemDataRole.UserRole, flags=Qt.MatchFlag.MatchExactly) int¶
Returns the index of the item containing the given data for the given role; otherwise returns -1.
- findText(text: str, flags=Qt.MatchFlag.MatchExactly)¶
Returns the index of the item containing the given text; otherwise returns -1.
- clear()¶
Clears the combobox, removing all items.
- count()¶
Returns the number of items in the combobox
- setMaxVisibleItems(num: int)¶
Set the maximum allowed size on screen of the combo box, measured in items, set to -1 indicates no restriction
- maxVisibleItems()¶
Returns the maximum allowed size on screen of the combo box, measured in items
- class ModelComboBox(parent=None)¶
Bases:
PyQt5.QtWidgets.QPushButton,ModelComboBoxBaseCombo box build in data model
- currentIndexChanged¶
- currentTextChanged¶
- activated¶
- textActivated¶
- arrowAni¶
- setIconVisible(isVisible: bool)¶
- isIconVisible()¶
- setPlaceholderText(text: str)¶
- clear()¶
Clears the combobox, removing all items.
- setItemIcon(index, icon)¶
Sets the data role for the item on the given index
- mouseReleaseEvent(e)¶
- paintEvent(e)¶
- class EditableModelComboBox(parent=None)¶
Bases:
qfluentwidgets.components.widgets.line_edit.LineEdit,ModelComboBoxBaseEditable combo box build in data model
- currentIndexChanged¶
- currentTextChanged¶
- activated¶
- textActivated¶
- dropButton¶
- currentText()¶
- clear()¶
Clears the combobox, removing all items.
- setPlaceholderText(text: str)¶