Medical Imaging Interaction Toolkit
2024.06.00
Medical Imaging Interaction Toolkit
|
#include <QmitkDataStorageListModel.h>
Public Member Functions | |
QmitkDataStorageListModel (mitk::DataStorage *dataStorage=nullptr, mitk::NodePredicateBase::Pointer pred=nullptr, QObject *parent=nullptr) | |
~QmitkDataStorageListModel () override | |
void | SetDataStorage (mitk::DataStorage::Pointer dataStorage) |
Change the data storage to represent. More... | |
mitk::DataStorage * | GetDataStorage () const |
Get the represented data storage. More... | |
void | SetPredicate (mitk::NodePredicateBase *pred) |
Change the filter predicate. More... | |
mitk::NodePredicateBase * | GetPredicate () const |
Get the filter predicate in use. More... | |
std::vector< mitk::DataNode * > | GetDataNodes () const |
Get all current data nodes. More... | |
mitk::DataNode::Pointer | getNode (const QModelIndex &index) const |
Return the node for given model index. More... | |
QModelIndex | getIndex (const mitk::DataNode *node) const |
Return the model index of the given node. More... | |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
Implements QAbstractListModel. More... | |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
Implements QAbstractListModel. More... | |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
Implements QAbstractListModel. More... | |
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
Implements QAbstractListModel. More... | |
virtual void | OnDataStorageNodeAdded (const mitk::DataNode *node) |
virtual void | OnDataStorageNodeRemoved (const mitk::DataNode *node) |
virtual void | OnDataNodeModified (const itk::Object *caller, const itk::EventObject &event) |
virtual void | OnDataModified (const itk::Object *caller, const itk::EventObject &event) |
virtual void | OnDataStorageDeleted (const itk::Object *caller, const itk::EventObject &event) |
Protected Member Functions | |
void | reset () |
Resets the whole model. Get all nodes matching the predicate from the data storage. More... | |
void | AddNodeToInternalList (mitk::DataNode *node) |
Internal helper: adds given node to end of list. More... | |
void | RemoveNodeFromInternalList (mitk::DataNode *node) |
Internal helper: remove given node. More... | |
void | ClearInternalNodeList () |
Internal helper: Clear complete model list. More... | |
Qt list model for the (optionally filtered) nodes in a DataStorage.
Given a data storage instance, this model will observe the storage for its list of nodes and keep the provided Qt model up to date. When given a NodePredicateBase instance, the Qt model will only contain nodes that satisfy the predicate. This is useful to display lists of a certain data type only, for example.
Developer notes:
Definition at line 41 of file QmitkDataStorageListModel.h.
QmitkDataStorageListModel::QmitkDataStorageListModel | ( | mitk::DataStorage * | dataStorage = nullptr , |
mitk::NodePredicateBase::Pointer | pred = nullptr , |
||
QObject * | parent = nullptr |
||
) |
dataStorage | the data storage to represent |
pred | the optional predicate to filter filters |
parent | the Qt parent of this Qt object |
|
override |
|
protected |
Internal helper: adds given node to end of list.
|
protected |
Internal helper: Clear complete model list.
|
override |
Implements QAbstractListModel.
|
override |
Implements QAbstractListModel.
std::vector<mitk::DataNode *> QmitkDataStorageListModel::GetDataNodes | ( | ) | const |
Get all current data nodes.
mitk::DataStorage* QmitkDataStorageListModel::GetDataStorage | ( | ) | const |
Get the represented data storage.
QModelIndex QmitkDataStorageListModel::getIndex | ( | const mitk::DataNode * | node | ) | const |
Return the model index of the given node.
mitk::DataNode::Pointer QmitkDataStorageListModel::getNode | ( | const QModelIndex & | index | ) | const |
Return the node for given model index.
mitk::NodePredicateBase* QmitkDataStorageListModel::GetPredicate | ( | ) | const |
Get the filter predicate in use.
|
override |
Implements QAbstractListModel.
|
virtual |
Callback entry for observed BaseDatas' ModifiedEvent().
Emits signal dataChanged().
|
virtual |
Callback entry for observed DataNodes' ModifiedEvent().
Emits signal dataChanged().
|
virtual |
Callback entry for DataStorage's DeleteEvent().
Clears the model.
|
virtual |
Called when a DataStorage Add Event was thrown. May be reimplemented by deriving classes.
|
virtual |
Called when a DataStorage Remove Event was thrown. May be reimplemented by deriving classes.
|
protected |
Internal helper: remove given node.
|
protected |
Resets the whole model. Get all nodes matching the predicate from the data storage.
|
override |
Implements QAbstractListModel.
void QmitkDataStorageListModel::SetDataStorage | ( | mitk::DataStorage::Pointer | dataStorage | ) |
Change the data storage to represent.
void QmitkDataStorageListModel::SetPredicate | ( | mitk::NodePredicateBase * | pred | ) |
Change the filter predicate.