Skip to content

ActionsModel

Base classes

Name Children Inherits
ColumnTableModel
prettyqt.itemmodels.columnitemmodel
List-based table model with columns defined by ColumnItem classes.

⋔ Inheritance diagram

graph TD
  1894229385["itemmodels.ActionsModel"]
  2904573146["itemmodels.ColumnTableModel"]
  2612381175["itemmodels.ListMixin"]
  2751680898["builtins.object"]
  1030521844["itemmodels.ColumnItemModelMixin"]
  656210031["core.AbstractTableModel"]
  4092674192["core.AbstractTableModelMixin"]
  3882849576["core.AbstractItemModelMixin"]
  3227531497["core.ObjectMixin"]
  232985924["QtCore.QAbstractTableModel"]
  1898060022["QtCore.QAbstractItemModel"]
  3984060476["QtCore.QObject"]
  37984305["Shiboken.Object"]
  2904573146 --> 1894229385
  2612381175 --> 2904573146
  2751680898 --> 2612381175
  1030521844 --> 2904573146
  2751680898 --> 1030521844
  656210031 --> 2904573146
  4092674192 --> 656210031
  3882849576 --> 4092674192
  3227531497 --> 3882849576
  2751680898 --> 3227531497
  2751680898 --> 3882849576
  2751680898 --> 4092674192
  232985924 --> 656210031
  1898060022 --> 232985924
  3984060476 --> 1898060022
  37984305 --> 3984060476
  2751680898 --> 37984305

🛈 DocStrings

Bases: ColumnTableModel

Table model to display a list of QActions.

All properties of the Action can be edited.

Source code in prettyqt/itemmodels/actionsmodel.py
class ActionsModel(itemmodels.ColumnTableModel):
    """Table model to display a list of QActions.

    All properties of the Action can be edited.
    """

    SUPPORTS = Sequence[gui.QAction]
    COLUMNS: ClassVar = [
        NameColumn,
        ToolTipColumn,
        ShortcutColumn,
        CheckStateColumn,
        PriorityColumn,
        UsageCountColumn,
    ]

    def __init__(
        self, actions: Sequence[gui.QAction], parent: core.QObject | None = None
    ):
        super().__init__(list(actions), self.COLUMNS, parent=parent)

    @classmethod
    def supports(cls, instance) -> bool:
        match instance:
            case (gui.QAction(), *_):
                return True
            case _:
                return False

:fa-brands-github: Show source on GitHub