TermTk.TTkWidgets.TTkModelView.tablemodellist
TTkTableModelList
- class TTkTableModelList(*, data: list[list[object]] = [], header: list[str] = [], indexes: list[str] = [])[source]
TTkTableModelList
extendsTTkAbstractTableModel
, including a basic model with a 2d list data structure- Parameters
data (list[list]) – the 2D List model for the view to present.
header (list[str], optional) – the header labels, defaults to the column number.
indexes (list[str], optional) – the index labels, defaults to the line number.
- data(row: int, col: int) None [source]
Returns the data stored for the item referred to by the row/column.
Note: If you do not have a value to return, return None instead of returning 0.
- Parameters
row (int) – the row position of the data
col (int) – the column position of the data
- Returns
object
- flags(row: int, col: int) ItemFlag [source]
Returns the item flags for the given row,column.
The base class implementation returns a combination of flags that enables the item (
ItemIsEnabled
) and allows it to be selected (ItemIsSelectable
).- Parameters
row (int) – the row position od the data
col (int) – the column position of the data
- Returns
- headerData(num: int, orientation: int)[source]
Returns the data for the given role and section in the header with the specified orientation.
For horizontal headers, the section number corresponds to the column number. Similarly, for vertical headers, the section number corresponds to the row number.
- index(row: int, col: int) TTkModelIndex [source]
Returns the index of the item in the model specified by the given row, column.
- Parameters
row (int) – the row position of the index
col (int) – the column position of the index
- Returns
- setData(row: int, col: int, data: object) None [source]
Returns true if successful; otherwise returns false.
The
dataChanged()
signal should be emitted if the data was successfully set.The base class implementation returns false. This function and
data()
must be reimplemented for editable models.- Parameters
row (int) – the row position of the data
col (int) – the column position of the data
data (object) – the data to be set in the (row,col) position of the table
- Returns
bool