21 #ifndef QmitkDataStorageListModel_h
22 #define QmitkDataStorageListModel_h
31 #include <QAbstractListModel>
56 mitk::NodePredicateBase::Pointer pred =
nullptr,
57 QObject *parent =
nullptr);
77 mitk::DataNode::Pointer
getNode(
const QModelIndex &index)
const;
83 Qt::ItemFlags
flags(
const QModelIndex &index)
const override;
86 QVariant
data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
89 QVariant
headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
92 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
116 virtual void OnDataModified(
const itk::Object *caller,
const itk::EventObject &event);
137 enum OBSERVER_TUPLE_NAMES
145 mitk::NodePredicateBase::Pointer m_NodePredicate;
152 unsigned long m_DataStorageDeleteObserverTag;
158 std::vector<std::tuple<mitk::DataNode *, unsigned long, unsigned long>> m_NodesAndObserverTags;
void AddNodeToInternalList(mitk::DataNode *node)
Internal helper: adds given node to end of list.
virtual void OnDataNodeModified(const itk::Object *caller, const itk::EventObject &event)
std::vector< mitk::DataNode * > GetDataNodes() const
Get all current data nodes.
void ClearInternalNodeList()
Internal helper: Clear complete model list.
Qt::ItemFlags flags(const QModelIndex &index) const override
Implements QAbstractListModel.
void SetPredicate(mitk::NodePredicateBase *pred)
Change the filter predicate.
virtual void OnDataModified(const itk::Object *caller, const itk::EventObject &event)
mitk::DataNode::Pointer getNode(const QModelIndex &index) const
Return the node for given model index.
virtual void OnDataStorageNodeAdded(const mitk::DataNode *node)
void RemoveNodeFromInternalList(mitk::DataNode *node)
Internal helper: remove given node.
mitk::DataStorage * GetDataStorage() const
Get the represented data storage.
QModelIndex getIndex(const mitk::DataNode *node) const
Return the model index of the given node.
void SetDataStorage(mitk::DataStorage::Pointer dataStorage)
Change the data storage to represent.
~QmitkDataStorageListModel() override
virtual void OnDataStorageDeleted(const itk::Object *caller, const itk::EventObject &event)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Implements QAbstractListModel.
QmitkDataStorageListModel(mitk::DataStorage *dataStorage=nullptr, mitk::NodePredicateBase::Pointer pred=nullptr, QObject *parent=nullptr)
virtual void OnDataStorageNodeRemoved(const mitk::DataNode *node)
mitk::NodePredicateBase * GetPredicate() const
Get the filter predicate in use.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Implements QAbstractListModel.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Implements QAbstractListModel.
void reset()
Resets the whole model. Get all nodes matching the predicate from the data storage.
Central node class of the MITK data tree, associating a data object with properties and mappers.
Abstract data management class that organizes DataNode objects in a directed acyclic graph.
Abstract base class for predicates used to filter DataNode objects in DataStorage queries.