hamyar_paygah.view_models.consumables_table_model

View model for consumables list table in Mission details view.

Classes

ConsumablesTableModel

Table model for displaying consumables used in a mission.

Module Contents

class hamyar_paygah.view_models.consumables_table_model.ConsumablesTableModel(items=None, parent=None)

Bases: PySide6.QtCore.QAbstractTableModel

Table model for displaying consumables used in a mission.

Parameters:

items (collections.Counter[str] | None)

COLUMN_ITEM = 0
COLUMN_QUANTITY = 1
_items: list[tuple[str, int]] = []
set_items(items)

Replace model data with new consumables.

Parameters:

items (collections.Counter[str])

Return type:

None

rowCount(parent=QModelIndex())

Returns the number of rows in the model.

which corresponds to the number of unique consumable items.

Return type:

int

columnCount(parent=QModelIndex())

Returns the number of columns in the model.

Return type:

int

data(index, role=Qt.DisplayRole)

Returns the data to be displayed for a given cell based on the role.

Parameters:

index (PySide6.QtCore.QModelIndex)

Return type:

None | str | int

headerData(section, orientation, role=Qt.DisplayRole)

Returns the header data for the given section and orientation based on the role.

Return type:

Literal[‘نوع’, ‘تعداد’] | None