13 #ifndef QmitkDataStorageSimpleTreeModel_h
14 #define QmitkDataStorageSimpleTreeModel_h
84 QModelIndex
index(
int row,
int column,
const QModelIndex &parent = QModelIndex())
const override;
91 QModelIndex
parent(
const QModelIndex &child)
const override;
98 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
105 int columnCount(
const QModelIndex &parent = QModelIndex())
const override;
113 QVariant
data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
122 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole)
override;
131 QVariant
headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
138 Qt::ItemFlags
flags(
const QModelIndex &index)
const override;
144 void UpdateModelData();
149 TreeItem *TreeItemFromIndex(
const QModelIndex &index)
const;
150 QModelIndex IndexFromTreeItem(
TreeItem *item)
const;
158 std::list<const TreeItem*> m_TreeItems;
Abstract base class extending QAbstractItemModel for DataStorage-backed models.
Lightweight tree model for DataStorage contents.
void NodeChanged(const mitk::DataNode *node) override
Called when a node in the data storage has changed.
void NodePredicateChanged() override
Called when the node predicate has changed. Rebuilds the tree.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Returns data for the given index and role.
QmitkDataStorageSimpleTreeModel(QObject *parent)
Constructs the tree model.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Returns header data for the given section.
void DataStorageChanged() override
Called when the data storage has changed. Rebuilds the tree.
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns item flags for the given index.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns (always 1).
void NodeAdded(const mitk::DataNode *node) override
Called when a node is added to the data storage.
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Sets data at the given index (supports renaming nodes).
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of child rows under the given parent.
~QmitkDataStorageSimpleTreeModel() override
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Returns the model index for the given row and column under the given parent.
void NodeRemoved(const mitk::DataNode *node) override
Called when a node is removed from the data storage.
QModelIndex parent(const QModelIndex &child) const override
Returns the parent index for the given child.
Helper class representing a node in a tree structure of DataNodes.
Central node class of the MITK data tree, associating a data object with properties and mappers.