TTkModelIndex

TTkModelIndex🌶️

class TTkModelIndex[source]🌶️

Bases: object

This class is used as an index into item models derived from TTkAbstractTableModel. The index is used by item views, delegates, and selection models to locate an item in the model.

New TTkModelIndex objects are created by the model using the TTkAbstractTableModel -> index() function. An invalid model index can be constructed with the TTkModelIndex constructor.

Model indexes refer to items in models, and contain all the information required to specify their locations in those models. Each index is located in a given row and column; use row(), column(), and data() to obtain this information.

To obtain a model index that refers to an existing item in a model, call TTkAbstractTableModel -> index() with the required row and column values.

Methods🌶️

col() int[source]🌶️

Returns the column this model index refers to.

Returns:

int

data() object[source]🌶️

Returns the data for the item referred to by the index.

Returns:

object

row() int[source]🌶️

Returns the row this model index refers to.

Returns:

int

setData(data: object) None[source]🌶️

Set the data in the item referred by the current index.

Parameters:

data (object) – the data to be set in the (row,col) position of the table