Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
Own includes. More...
#include <QmitkDataStorageTableModel.h>
Classes | |
struct | DataNodeCompareFunction |
A struct that inherits from std::binary_function. You can use it in std::sort algorithm for sorting the node list elements. More... | |
Public Member Functions | |
QmitkDataStorageTableModel (mitk::DataStorage::Pointer _DataStorage, mitk::NodePredicateBase *_Predicate=nullptr, QObject *parent=nullptr) | |
virtual | ~QmitkDataStorageTableModel () |
const mitk::DataStorage::Pointer | GetDataStorage () const |
mitk::NodePredicateBase::Pointer | GetPredicate () const |
mitk::DataNode::Pointer | GetNode (const QModelIndex &index) const |
virtual QVariant | headerData (int section, Qt::Orientation orientation, int role) const override |
virtual Qt::ItemFlags | flags (const QModelIndex &index) const override |
virtual int | rowCount (const QModelIndex &parent) const override |
virtual int | columnCount (const QModelIndex &parent) const override |
virtual QVariant | data (const QModelIndex &index, int role) const override |
void | SetDataStorage (mitk::DataStorage::Pointer _DataStorage) |
void | SetPredicate (mitk::NodePredicateBase *_Predicate) |
virtual void | AddNode (const mitk::DataNode *node) |
virtual void | RemoveNode (const mitk::DataNode *node) |
virtual std::vector< mitk::DataNode * > | GetNodeSet () const |
virtual void | PropertyModified (const itk::Object *caller, const itk::EventObject &event) |
Called when a single property was changed. The function searches through the list of nodes in this model for the changed property. If the property was found a dataChanged signal is emitted forcing all observing views to request the data again. More... | |
bool | setData (const QModelIndex &index, const QVariant &value, int role) override |
void | sort (int column, Qt::SortOrder order=Qt::AscendingOrder) override |
Reimplemented sort function from QAbstractTableModel to enable sorting on the table. More... | |
Protected Member Functions | |
virtual void | Reset () |
Protected Attributes | |
mitk::WeakPointer< mitk::DataStorage > | m_DataStorage |
mitk::NodePredicateBase::Pointer | m_Predicate |
std::vector< mitk::DataNode * > | m_NodeSet |
std::map< mitk::BaseProperty *, unsigned long > | m_NamePropertyModifiedObserverTags |
Maps a property to an observer tag. More... | |
std::map< mitk::BaseProperty *, unsigned long > | m_VisiblePropertyModifiedObserverTags |
Maps a property to an observer tag. More... | |
bool | m_BlockEvents |
bool | m_SortDescending |
The property is true when the property list is sorted in descending order. More... | |
Own includes.
Toolkit includes. Forward declarations.
A table model for a set of DataNodes defined by a predicate. make columns interchangeable, select which properties to show as columns
Definition at line 40 of file QmitkDataStorageTableModel.h.
QmitkDataStorageTableModel::QmitkDataStorageTableModel | ( | mitk::DataStorage::Pointer | _DataStorage, |
mitk::NodePredicateBase * | _Predicate = nullptr , |
||
QObject * | parent = nullptr |
||
) |
Constructs a new QmitkDataStorageTableModel and sets a predicate that defines this list.
Definition at line 33 of file QmitkDataStorageTableModel.cpp.
References SetDataStorage(), and SetPredicate().
|
virtual |
Standard dtor. Delete predicate, disconnect from DataStorage.
Definition at line 46 of file QmitkDataStorageTableModel.cpp.
References SetDataStorage().
|
virtual |
Adds a node to this model. There are two constraints for nodes in this model:
Definition at line 236 of file QmitkDataStorageTableModel.cpp.
References mitk::DataNode::GetData(), mitk::DataNode::GetProperty(), m_BlockEvents, m_NamePropertyModifiedObserverTags, m_NodeSet, m_Predicate, m_VisiblePropertyModifiedObserverTags, mitk::New(), and PropertyModified().
Referenced by Reset(), and SetDataStorage().
|
overridevirtual |
Overridden from QAbstractTableModel. Returns the number of features (columns) to display.
Definition at line 124 of file QmitkDataStorageTableModel.cpp.
|
overridevirtual |
Overridden from QAbstractTableModel. Returns the data at index for given role.
Definition at line 131 of file QmitkDataStorageTableModel.cpp.
References QmitkNodeDescriptorManager::GetDescriptor(), QmitkNodeDescriptor::GetIcon(), QmitkNodeDescriptorManager::GetInstance(), QmitkNodeDescriptor::GetNameOfClass(), m_NodeSet, and QmitkDataNodeRole.
|
overridevirtual |
Overridden from QAbstractTableModel. Returns what can be done with an item.
Definition at line 102 of file QmitkDataStorageTableModel.cpp.
const mitk::DataStorage::Pointer QmitkDataStorageTableModel::GetDataStorage | ( | ) | const |
Get the DataStorage.
Definition at line 53 of file QmitkDataStorageTableModel.cpp.
References mitk::WeakPointer< TObjectType >::GetPointer(), and m_DataStorage.
mitk::DataNode::Pointer QmitkDataStorageTableModel::GetNode | ( | const QModelIndex & | index | ) | const |
Get node at a specific model index. Another way to implement this, is by introducing a new role like "DateTreeNode" and capture that in the data function.
Definition at line 63 of file QmitkDataStorageTableModel.cpp.
References m_NodeSet.
|
virtual |
Returns a copy of the node-vector that is shown by this model
Definition at line 469 of file QmitkDataStorageTableModel.cpp.
References m_NodeSet.
mitk::NodePredicateBase::Pointer QmitkDataStorageTableModel::GetPredicate | ( | ) | const |
Get the predicate.
Definition at line 58 of file QmitkDataStorageTableModel.cpp.
References m_Predicate.
|
overridevirtual |
Overridden from QAbstractTableModel. Returns the header data at section for given orientation and role.
Definition at line 75 of file QmitkDataStorageTableModel.cpp.
|
virtual |
Called when a single property was changed. The function searches through the list of nodes in this model for the changed property. If the property was found a dataChanged signal is emitted forcing all observing views to request the data again.
Definition at line 317 of file QmitkDataStorageTableModel.cpp.
References m_BlockEvents, and m_NodeSet.
Referenced by AddNode().
|
virtual |
Removes a node from this model. Also removes any event listener from the node.
Definition at line 278 of file QmitkDataStorageTableModel.cpp.
References m_BlockEvents, m_NamePropertyModifiedObserverTags, m_NodeSet, and m_VisiblePropertyModifiedObserverTags.
Referenced by Reset(), and SetDataStorage().
|
protectedvirtual |
Called when DataStorage or Predicate changed. Resets whole model and reads all nodes in again.
Definition at line 397 of file QmitkDataStorageTableModel.cpp.
References AddNode(), mitk::DataStorage::GetAll(), mitk::DataStorage::GetSubset(), mitk::WeakPointer< TObjectType >::IsNotNull(), m_DataStorage, m_NamePropertyModifiedObserverTags, m_NodeSet, m_Predicate, m_VisiblePropertyModifiedObserverTags, and RemoveNode().
Referenced by SetDataStorage(), and SetPredicate().
|
overridevirtual |
Overridden from QAbstractTableModel. Returns the node count.
Definition at line 119 of file QmitkDataStorageTableModel.cpp.
References m_NodeSet.
|
override |
Overridden from QAbstractTableModel. Sets data at index for given role.
Definition at line 364 of file QmitkDataStorageTableModel.cpp.
References mitk::RenderingManager::GetInstance(), m_BlockEvents, m_NodeSet, and mitk::RenderingManager::RequestUpdateAll().
void QmitkDataStorageTableModel::SetDataStorage | ( | mitk::DataStorage::Pointer | _DataStorage | ) |
Sets the DataStorage.
Definition at line 198 of file QmitkDataStorageTableModel.cpp.
References mitk::MessageBase< AbstractDelegate >::AddListener(), AddNode(), mitk::DataStorage::AddNodeEvent, mitk::WeakPointer< TObjectType >::GetPointer(), mitk::WeakPointer< TObjectType >::IsNotNull(), m_DataStorage, mitk::MessageBase< AbstractDelegate >::RemoveListener(), RemoveNode(), mitk::DataStorage::RemoveNodeEvent, and Reset().
Referenced by QmitkDataStorageTableModel(), and ~QmitkDataStorageTableModel().
void QmitkDataStorageTableModel::SetPredicate | ( | mitk::NodePredicateBase * | _Predicate | ) |
Sets the predicate. QmitkDataStorageTableModel is owner of the predicate!
Definition at line 188 of file QmitkDataStorageTableModel.cpp.
References m_Predicate, and Reset().
Referenced by QmitkDataStorageTableModel().
|
override |
Reimplemented sort function from QAbstractTableModel to enable sorting on the table.
Definition at line 439 of file QmitkDataStorageTableModel.cpp.
References QmitkDataStorageTableModel::DataNodeCompareFunction::CompareByClassName, QmitkDataStorageTableModel::DataNodeCompareFunction::CompareByName, QmitkDataStorageTableModel::DataNodeCompareFunction::CompareByVisibility, QmitkDataStorageTableModel::DataNodeCompareFunction::Greater, QmitkDataStorageTableModel::DataNodeCompareFunction::Less, and m_NodeSet.
|
protected |
Saves if this model is currently working on events to prevent endless event loops.
Definition at line 220 of file QmitkDataStorageTableModel.h.
Referenced by AddNode(), PropertyModified(), RemoveNode(), and setData().
|
protected |
Pointer to the DataStorage from which the nodes are selected (remember: in BlueBerry there might be more than one DataStorage). Store it in a weak pointer. This is a GUI class which should not hold a strong reference to any non-GUI Object.
Definition at line 199 of file QmitkDataStorageTableModel.h.
Referenced by GetDataStorage(), Reset(), and SetDataStorage().
|
protected |
Maps a property to an observer tag.
Definition at line 212 of file QmitkDataStorageTableModel.h.
Referenced by AddNode(), RemoveNode(), and Reset().
|
protected |
Holds all selected Nodes.
Definition at line 208 of file QmitkDataStorageTableModel.h.
Referenced by AddNode(), data(), GetNode(), GetNodeSet(), PropertyModified(), RemoveNode(), Reset(), rowCount(), setData(), and sort().
|
protected |
Holds the predicate that defines this SubSet of Nodes. If m_Predicate is NULL all Nodes will be selected.
Definition at line 204 of file QmitkDataStorageTableModel.h.
Referenced by AddNode(), GetPredicate(), Reset(), and SetPredicate().
|
protected |
The property is true when the property list is sorted in descending order.
Definition at line 224 of file QmitkDataStorageTableModel.h.
|
protected |
Maps a property to an observer tag.
Definition at line 216 of file QmitkDataStorageTableModel.h.
Referenced by AddNode(), RemoveNode(), and Reset().