class documentation
class TableModel(QAbstractTableModel):
Constructor: TableModel(parent, data, row_keys, col_keys, ...)
TableModel class.
| Method | __init__ |
Initializes a table model. |
| Method | column |
Gets the number of columns. Note: Enabling allow_delete adds an extra column for the row delete buttons. |
| Method | data |
Gets a cell value. |
| Method | flags |
Gets the flags for a cell. |
| Method | header |
Sets the header data. |
| Method | is |
Checks if the cell is a widget button. |
| Method | row |
Gets the number of rows. |
| Method | set |
Sets a cell value. |
| Instance Variable | _col |
Undocumented |
| Instance Variable | _col |
Undocumented |
| Instance Variable | _data |
Undocumented |
| Instance Variable | _row |
Undocumented |
def __init__(self, parent:
QTableView, data: list[ list], row_keys: list[ str], col_keys: list[ str], col_is_widget: list[ bool] | None = None):
¶
Initializes a table model.
| Parameters | |
parent:QTableView | QTableView |
data:list[ | Data (2D) |
rowlist[ | List of vertical header strings |
collist[ | List of horizontal header strings |
collist[ | Indicates columns contains only widgets instead of only data (may be None for data-only) |
Gets the number of columns. Note: Enabling allow_delete adds an extra column for the row delete buttons.
| Returns | |
| Number of columns |
Gets a cell value.
| Parameters | |
index:QtCore.QModelIndex | Cell index |
role:int | Data role |
| Returns | |
QVariant | Cell value |
def headerData(self, section:
int, orientation: Qt.Orientation, role: int = Qt.DisplayRole) -> QVariant:
¶
Sets the header data.
| Parameters | |
section:int | Row or column |
orientation:Qt.Orientation | Orientation |
role:int | Data role |
| Returns | |
QVariant | Undocumented |
Checks if the cell is a widget button.
| Parameters | |
index:QtCore.QModelIndex | Cell index |
| Returns | |
bool | True if the cell is a widget, False otherwise |