combo_box

Module Contents

ComboItem

Combo box item

ComboBoxBase

Combo box base

ComboBox

Combo box

EditableComboBox

Editable combo box

ComboBoxMenu

Combo box menu

class ComboItem(text: str, icon: str | PyQt5.QtGui.QIcon | qfluentwidgets.common.icon.FluentIconBase = None, userData=None)

Combo box item

property icon
class ComboBoxBase(parent=None, **kwargs)

Bases: PyQt5.QtCore.QObject

Combo box base

currentIndexChanged
currentTextChanged
eventFilter(obj, e: PyQt5.QtCore.QEvent)
addItem(text: str, icon: str | PyQt5.QtGui.QIcon | qfluentwidgets.common.icon.FluentIconBase = None, userData=None)

add item

Parameters

text: str

the text of item

icon: str | QIcon | FluentIconBase

addItems(texts: Iterable[str])

add items

Parameters

text: Iterable[str]

the text of item

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()
setCurrentIndex(index: int)

set current index

Parameters

index: int

current index

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)

Sets the data role for the item on the given index

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)

Returns the index of the item containing the given data, otherwise returns -1

findText(text: str)

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

insertItem(index: int, text: str, icon: str | PyQt5.QtGui.QIcon | qfluentwidgets.common.icon.FluentIconBase = None, userData=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.

setMaxVisibleItems(num: int)
maxVisibleItems()
class ComboBox(parent=None)

Bases: PyQt5.QtWidgets.QPushButton, ComboBoxBase

Combo box

currentIndexChanged
currentTextChanged
setPlaceholderText(text: str)
setCurrentIndex(index: int)

set current index

Parameters

index: int

current index

mouseReleaseEvent(e)
paintEvent(e)
class EditableComboBox(parent=None)

Bases: qfluentwidgets.components.widgets.line_edit.LineEdit, ComboBoxBase

Editable combo box

currentIndexChanged
currentTextChanged
setCompleterMenu(menu)

set completer menu

Parameters

menu: CompleterMenu

completer menu

currentText()
setCurrentIndex(index: int)

set current index

Parameters

index: int

current index

clear()

Clears the combobox, removing all items.

setPlaceholderText(text: str)
class ComboBoxMenu(parent=None)

Bases: qfluentwidgets.components.widgets.menu.RoundMenu

Combo box menu

exec(pos, ani=True, aniType=MenuAnimationType.DROP_DOWN)

show menu

Parameters

pos: QPoint

pop-up position

ani: bool

Whether to show pop-up animation

aniType: MenuAnimationType

menu animation type