#include <Gui/TreeModel/TreeModel.hpp>
|
void | modelRebuilt () |
| Emitted when the model has been rebuilt.
|
|
|
| TreeModel (QObject *parent=nullptr) |
|
void | rebuildModel () |
|
|
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
|
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
|
QVariant | data (const QModelIndex &index, int role) const override |
|
bool | setData (const QModelIndex &index, const QVariant &value, int role) override |
|
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
|
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
|
QModelIndex | parent (const QModelIndex &child) const override |
|
Qt::ItemFlags | flags (const QModelIndex &index) const override |
|
|
virtual std::string | getHeaderString () const =0 |
|
virtual void | buildModel ()=0 |
|
TreeItem * | getItem (const QModelIndex &index) const |
| Get the tree item corresponding to the given index.
|
|
bool | findInTree (const TreeItem *item) const |
| Internal functions to check if an item is in the tree.
|
|
void | printModel () const |
| Prints elements in the model to stdout (debug only)
|
|
void | setAllItemsChecked (bool checked=true) |
| Set the check state of all items.
|
|
void | setItemChecked (const QModelIndex &index, bool checked=true) |
| Set the check state of one item and all of its children.
|
|
This class implement QAbstractItem model with the TreeItem as its model Derived class must use some kind of cast to access the derived TreeItems.
Definition at line 78 of file TreeModel.hpp.
◆ TreeModel()
Ra::Gui::TreeModel::TreeModel |
( |
QObject * | parent = nullptr | ) |
|
|
inline |
◆ buildModel()
virtual void Ra::Gui::TreeModel::buildModel |
( |
| ) |
|
|
protectedpure virtual |
◆ columnCount()
int Ra::Gui::TreeModel::columnCount |
( |
const QModelIndex & | parent = QModelIndex() | ) |
const |
|
inlineoverride |
Returns the number of columns (only one in our case).
- Parameters
-
- Returns
Definition at line 99 of file TreeModel.hpp.
◆ data()
QVariant Ra::Gui::TreeModel::data |
( |
const QModelIndex & | index, |
|
|
int | role ) const |
|
override |
Return the data corresponding to the given index : in this case a string with the item name.
- Parameters
-
- Returns
Definition at line 32 of file TreeModel.cpp.
◆ findInTree()
bool Ra::Gui::TreeModel::findInTree |
( |
const TreeItem * | item | ) |
const |
|
protected |
Internal functions to check if an item is in the tree.
Definition at line 104 of file TreeModel.cpp.
◆ flags()
Qt::ItemFlags Ra::Gui::TreeModel::flags |
( |
const QModelIndex & | index | ) |
const |
|
override |
Get the flags of the object.
- Parameters
-
- Returns
Definition at line 89 of file TreeModel.cpp.
◆ getItem()
TreeItem * Ra::Gui::TreeModel::getItem |
( |
const QModelIndex & | index | ) |
const |
|
protected |
Get the tree item corresponding to the given index.
Definition at line 20 of file TreeModel.cpp.
◆ headerData()
QVariant Ra::Gui::TreeModel::headerData |
( |
int | section, |
|
|
Qt::Orientation | orientation, |
|
|
int | role = Qt::DisplayRole ) const |
|
override |
Return the header data of the given section.
- Parameters
-
- Returns
Definition at line 56 of file TreeModel.cpp.
◆ index()
QModelIndex Ra::Gui::TreeModel::index |
( |
int | row, |
|
|
int | column, |
|
|
const QModelIndex & | parent = QModelIndex() ) const |
|
override |
Create an index for the given row, column and parent.
- Parameters
-
- Returns
Definition at line 63 of file TreeModel.cpp.
◆ parent()
QModelIndex Ra::Gui::TreeModel::parent |
( |
const QModelIndex & | child | ) |
const |
|
override |
Get the parent of a given child item.
- Parameters
-
- Returns
Definition at line 75 of file TreeModel.cpp.
◆ printModel()
void Ra::Gui::TreeModel::printModel |
( |
| ) |
const |
|
protected |
Prints elements in the model to stdout (debug only)
Definition at line 118 of file TreeModel.cpp.
◆ rebuildModel()
void Ra::Gui::TreeModel::rebuildModel |
( |
| ) |
|
Call this function to update the tree model to the current content of the engine.
Definition at line 95 of file TreeModel.cpp.
◆ rowCount()
int Ra::Gui::TreeModel::rowCount |
( |
const QModelIndex & | parent = QModelIndex() | ) |
const |
|
override |
Returns the number of rows, i.e .the number of children of a given parent item.
- Parameters
-
- Returns
The row count of an item is the number of child it has.
Definition at line 13 of file TreeModel.cpp.
◆ setAllItemsChecked()
void Ra::Gui::TreeModel::setAllItemsChecked |
( |
bool | checked = true | ) |
|
|
protected |
◆ setData()
bool Ra::Gui::TreeModel::setData |
( |
const QModelIndex & | index, |
|
|
const QVariant & | value, |
|
|
int | role ) |
|
override |
◆ setItemChecked()
void Ra::Gui::TreeModel::setItemChecked |
( |
const QModelIndex & | index, |
|
|
bool | checked = true ) |
|
protected |
Set the check state of one item and all of its children.
Definition at line 141 of file TreeModel.cpp.
◆ m_rootItem
The documentation for this class was generated from the following files:
- /home/runner/work/Radium-Engine/Radium-Engine/src/Radium-Engine/src/Gui/TreeModel/TreeModel.hpp
- /home/runner/work/Radium-Engine/Radium-Engine/src/Radium-Engine/src/Gui/TreeModel/TreeModel.cpp