13 #ifndef QmitkDataStorageListModel_h
14 #define QmitkDataStorageListModel_h
23 #include <QAbstractListModel>
48 mitk::NodePredicateBase::Pointer pred =
nullptr,
49 QObject *parent =
nullptr);
69 mitk::DataNode::Pointer
getNode(
const QModelIndex &index)
const;
75 Qt::ItemFlags
flags(
const QModelIndex &index)
const override;
78 QVariant
data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
81 QVariant
headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
84 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
108 virtual void OnDataModified(
const itk::Object *caller,
const itk::EventObject &event);
129 enum OBSERVER_TUPLE_NAMES
137 mitk::NodePredicateBase::Pointer m_NodePredicate;
144 unsigned long m_DataStorageDeleteObserverTag;
150 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.
Class for nodes of the DataTree.
Data management class that handles 'was created by' relations.
Interface for evaluation conditions used in the DataStorage class GetSubset() method.