Alto
dev

alto.ui.dropdown

Shared dropdown fields with rounded popup windows.

Examples

>>> FieldComboBox().property("field")
True

FieldComboBox

FieldComboBox(parent: QWidget | None = None)

Bases: QComboBox

A shared dropdown whose field and popup both use Alto’s rounded styling.

Examples

>>> picker = FieldComboBox()
>>> picker.addItems(["m2", "M2", "m3"])
>>> picker.currentText()
'm2'

Constructor

Create a themed dropdown and prepare to clip its popup corners.

Parameters

  • parent (QWidget or None, default None): The widget that owns the dropdown.

Constructor examples

>>> FieldComboBox().maxVisibleItems()
12

FieldComboBox.showPopup

def showPopup() -> None

Open the dropdown with a rounded outer window, including its native container.

Examples

>>> picker = FieldComboBox()
>>> picker.addItems(["P4", "P5"])
>>> picker.showPopup()
>>> picker.view().window().mask().isEmpty()
False
>>> picker.hidePopup()

FieldComboBox.eventFilter

def eventFilter(
    watched: QObject,
    event: QEvent,
) -> bool

Keep popup clipping synchronized with layout and size changes.

Parameters

  • watched (QObject): The object receiving the event.
  • event (QEvent): The event being filtered.

Returns

  • bool: Whether the superclass consumes the event.

Examples

>>> picker = FieldComboBox()
>>> picker.eventFilter(picker, QEvent(QEvent.Type.None_))
False