combo_box
Combo-box components for the AYON UI Qt library.
This module provides :class:AYComboBox, a styled :class:QComboBox subclass that supports per-item coloured icons, a short-text display mode, and an icon-only display mode via :class:~ayon_core.ui.data_models.MenuSize. A dropdown arrow is drawn using the Material Symbol arrow_drop_down icon so the widget is visually recognizable as a dropdown when show_chevron is true.
It also exposes :class:AYComboBoxModel, the default :class:QStandardItemModel subclass that adds two extra item-data roles:
ShortTextRole- an abbreviated label shown when the combo-box is in :attr:~ayon_core.ui.data_models.MenuSize.Shortmode.IconNameRole- the Material Symbol icon name used to regenerate icons when the inverted colour mode is toggled.
A drop-in sample dataset :data:ALL_STATUSES is included for quick prototyping and automated tests.
Typical usage::
from ayon_core.ui.components.combo_box import AYComboBox, ALL_STATUSES
combo = AYComboBox(parent=my_widget, items=ALL_STATUSES)
combo.set_size("short") # or MenuSize.Short
combo.set_inverted(True)
Custom model usage (must expose ShortTextRole and IconNameRole)::
model = MyCustomModel(parent=combo)
combo.setModel(model)
Note
When a custom model that does not expose ShortTextRole / IconNameRole is set via :meth:AYComboBox.setModel, the widget falls back to displaying "< INCOMPATIBLE MODEL >" in short mode and raises :exc:RuntimeError when :meth:AYComboBox.add_item or :meth:AYComboBox.update_items is called.