Select

class compas_view2.ui.Select(app, parent, *, items, action)[source]

Bases: object

Class representing a selection list.

Parameters:
  • app (compas_view2.app.App) – The app containing the widget.

  • parent (QtWidgets.QWidget) – The parent widget for the combo box.

  • items (list[dict[str, Any]]) – A list of selection options, with each item defined as a dict with a particular structure. See Notes for more info.

  • action (callable) – The action associated with the combo box.

Attributes:
  • combo (QtWidgets.QComboBox) – The combo box containing the selection options.

  • action (callable) – The action associated with the index change event of the combo box.

Notes

Every item dict should have the following structure.

item['text']     # str  : The text label of the item.