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