TreeModel
-
class TreeModel : public QAbstractItemModel
Public Functions
-
~TreeModel()
Destructor.
-
QVariant data(const QModelIndex &pIndex, int pRole) const override
Fetches the data from TreeItem stored in specific column.
- Parameters:
pIndex –
pRole –
- Returns:
bool
-
Qt::ItemFlags flags(const QModelIndex &pIndex) const override
Checks if the QModelindex is valid.
- Parameters:
pIndex –
- Returns:
ItemsFlag
-
QVariant headerData(int pSection, Qt::Orientation pOrientation, int pRole = Qt::DisplayRole) const override
Gets the header data of root items.
- Parameters:
pSection –
pOrientation –
pRole –
- Returns:
QVariant
-
QModelIndex index(int pRow, int pColumn, const QModelIndex &pParent = QModelIndex()) const override
It validates and returns the index.
If it doesn’t exists, it creates a new one
- Parameters:
pRow –
pColumn –
pParent –
- Returns:
-
QModelIndex parent(const QModelIndex &pParent = QModelIndex()) const override
Validates and creates a new parent index.
- Parameters:
pIndex –
- Returns:
index
-
int rowCount(const QModelIndex &pParent = QModelIndex()) const override
It returns the count of rows.
- Parameters:
pParent –
- Returns:
int
-
int columnCount(const QModelIndex &pParent = QModelIndex()) const override
It returns the count of column.
- Parameters:
pParent –
- Returns:
number of columns
Private Functions
-
~TreeModel()