ComboBox
- class ComboBox[source]
Bases:
QComboBox
A customizable combo box widget, supporting item-specific rendering with an optional color delegate.
- Parameters:
- itemslist
List of items to populate the combo box.
- change_callbackCallable
Function to execute on value change. Should accept a single argument corresponding to the selected item’s data.
- paintbool, optional
Whether to use a custom delegate for item rendering, such as displaying colors. Defaults to None.
- Attributes:
- paintbool
Flag indicating whether custom item rendering is enabled.
- assigned_colorQColor or None
The color assigned to the combo box before any changes.
- is_changedbool
Indicates if the color has been changed through user interaction.
Methods
populate(items: list) -> None
Populates the combo box with items.
setAssignedColor(color: QColor) -> None
Sets the assigned color to be displayed when the item is not changed.
on_index_changed(change_callback: Callable, index: int) -> None
Handles the index change event and triggers the callback.
paintEvent(event) -> None
Custom painting for the combo box, used when paint is True.
Methods
Handles the index change event and triggers the callback.
Populate the combo box with items.
Sets the assigned color to be displayed when the item is not changed.
Inherited Methods