Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
QmitkDataStorageTableModel Class Reference

Own includes. More...

#include <QmitkDataStorageTableModel.h>

Inheritance diagram for QmitkDataStorageTableModel:
Collaboration diagram for QmitkDataStorageTableModel:

Classes

struct  DataNodeCompareFunction
 A struct that you can use 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)
 
 ~QmitkDataStorageTableModel () override
 
const mitk::DataStorage::Pointer GetDataStorage () const
 
mitk::NodePredicateBase::Pointer GetPredicate () const
 
mitk::DataNode::Pointer GetNode (const QModelIndex &index) const
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const override
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
int rowCount (const QModelIndex &parent) const override
 
int columnCount (const QModelIndex &parent) const override
 
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::DataStoragem_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...
 

Detailed Description

Own includes.

Toolkit includes. Forward declarations.

A table model for a set of DataNodes defined by a predicate.

Definition at line 36 of file QmitkDataStorageTableModel.h.

Constructor & Destructor Documentation

◆ QmitkDataStorageTableModel()

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.

See also
setPredicate()

◆ ~QmitkDataStorageTableModel()

QmitkDataStorageTableModel::~QmitkDataStorageTableModel ( )
override

Standard dtor. Delete predicate, disconnect from DataStorage.

Member Function Documentation

◆ AddNode()

virtual void QmitkDataStorageTableModel::AddNode ( const mitk::DataNode node)
virtual

Adds a node to this model. There are two constraints for nodes in this model:

  1. If a predicate is set (not null) the node will be checked against it.
  2. The node has to have a data object (no one wants to see empty nodes). Also adds event listeners to the node.

◆ columnCount()

int QmitkDataStorageTableModel::columnCount ( const QModelIndex &  parent) const
override

Overridden from QAbstractTableModel. Returns the number of features (columns) to display.

◆ data()

QVariant QmitkDataStorageTableModel::data ( const QModelIndex &  index,
int  role 
) const
override

Overridden from QAbstractTableModel. Returns the data at index for given role.

◆ flags()

Qt::ItemFlags QmitkDataStorageTableModel::flags ( const QModelIndex &  index) const
override

Overridden from QAbstractTableModel. Returns what can be done with an item.

◆ GetDataStorage()

const mitk::DataStorage::Pointer QmitkDataStorageTableModel::GetDataStorage ( ) const

Get the DataStorage.

◆ GetNode()

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.

◆ GetNodeSet()

virtual std::vector<mitk::DataNode *> QmitkDataStorageTableModel::GetNodeSet ( ) const
virtual

Returns a copy of the node-vector that is shown by this model

◆ GetPredicate()

mitk::NodePredicateBase::Pointer QmitkDataStorageTableModel::GetPredicate ( ) const

Get the predicate.

◆ headerData()

QVariant QmitkDataStorageTableModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const
override

Overridden from QAbstractTableModel. Returns the header data at section for given orientation and role.

◆ PropertyModified()

virtual void QmitkDataStorageTableModel::PropertyModified ( const itk::Object *  caller,
const itk::EventObject &  event 
)
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.

◆ RemoveNode()

virtual void QmitkDataStorageTableModel::RemoveNode ( const mitk::DataNode node)
virtual

Removes a node from this model. Also removes any event listener from the node.

◆ Reset()

virtual void QmitkDataStorageTableModel::Reset ( )
protectedvirtual

Called when DataStorage or Predicate changed. Resets whole model and reads all nodes in again.

◆ rowCount()

int QmitkDataStorageTableModel::rowCount ( const QModelIndex &  parent) const
override

Overridden from QAbstractTableModel. Returns the node count.

◆ setData()

bool QmitkDataStorageTableModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role 
)
override

Overridden from QAbstractTableModel. Sets data at index for given role.

◆ SetDataStorage()

void QmitkDataStorageTableModel::SetDataStorage ( mitk::DataStorage::Pointer  _DataStorage)

Sets the DataStorage.

◆ SetPredicate()

void QmitkDataStorageTableModel::SetPredicate ( mitk::NodePredicateBase _Predicate)

Sets the predicate. QmitkDataStorageTableModel is owner of the predicate!

◆ sort()

void QmitkDataStorageTableModel::sort ( int  column,
Qt::SortOrder  order = Qt::AscendingOrder 
)
override

Reimplemented sort function from QAbstractTableModel to enable sorting on the table.

Member Data Documentation

◆ m_BlockEvents

bool QmitkDataStorageTableModel::m_BlockEvents
protected

Saves if this model is currently working on events to prevent endless event loops.

Definition at line 216 of file QmitkDataStorageTableModel.h.

◆ m_DataStorage

mitk::WeakPointer<mitk::DataStorage> QmitkDataStorageTableModel::m_DataStorage
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 195 of file QmitkDataStorageTableModel.h.

◆ m_NamePropertyModifiedObserverTags

std::map<mitk::BaseProperty *, unsigned long> QmitkDataStorageTableModel::m_NamePropertyModifiedObserverTags
protected

Maps a property to an observer tag.

Definition at line 208 of file QmitkDataStorageTableModel.h.

◆ m_NodeSet

std::vector<mitk::DataNode *> QmitkDataStorageTableModel::m_NodeSet
protected

Holds all selected Nodes.

Definition at line 204 of file QmitkDataStorageTableModel.h.

◆ m_Predicate

mitk::NodePredicateBase::Pointer QmitkDataStorageTableModel::m_Predicate
protected

Holds the predicate that defines this SubSet of Nodes. If m_Predicate is nullptr all Nodes will be selected.

Definition at line 200 of file QmitkDataStorageTableModel.h.

◆ m_SortDescending

bool QmitkDataStorageTableModel::m_SortDescending
protected

The property is true when the property list is sorted in descending order.

Definition at line 220 of file QmitkDataStorageTableModel.h.

◆ m_VisiblePropertyModifiedObserverTags

std::map<mitk::BaseProperty *, unsigned long> QmitkDataStorageTableModel::m_VisiblePropertyModifiedObserverTags
protected

Maps a property to an observer tag.

Definition at line 212 of file QmitkDataStorageTableModel.h.


The documentation for this class was generated from the following file: