Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkDataStorageHistoryModel Class Reference

DataStorage model that maintains a history of node selections. More...

#include <QmitkDataStorageHistoryModel.h>

Inheritance diagram for QmitkDataStorageHistoryModel:
Collaboration diagram for QmitkDataStorageHistoryModel:

Public Member Functions

 QmitkDataStorageHistoryModel (QObject *parent)
 Constructs the history model. More...
 
- Public Member Functions inherited from QmitkDataStorageDefaultListModel
 QmitkDataStorageDefaultListModel (QObject *parent)
 Constructs the model. More...
 
void DataStorageChanged () override
 Called when the data storage has changed. Rebuilds the model data. More...
 
void NodePredicateChanged () override
 Called when the node predicate has changed. Rebuilds the model data. More...
 
void NodeAdded (const mitk::DataNode *node) override
 Called when a node is added to the data storage. More...
 
void NodeChanged (const mitk::DataNode *node) override
 Called when a node in the data storage has changed. More...
 
void NodeRemoved (const mitk::DataNode *node) override
 Called when a node is removed from the data storage. More...
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
 Returns the model index for the given row and column. More...
 
QModelIndex parent (const QModelIndex &child) const override
 Returns the parent index. Always returns an invalid index (flat model). More...
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 Returns the number of rows (nodes) in the model. More...
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 Returns the number of columns. Always returns 1. More...
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 Returns data for the given index and role. More...
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 Returns header data for the given section and orientation. More...
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 Returns the item flags for the given index. More...
 
- Public Member Functions inherited from QmitkAbstractDataStorageModel
 ~QmitkAbstractDataStorageModel () override
 
void SetDataStorage (mitk::DataStorage *dataStorage)
 Sets the data storage and registers node event listeners. More...
 
mitk::DataStorage::Pointer GetDataStorage () const
 Returns a locked pointer to the current data storage. More...
 
void SetNodePredicate (const mitk::NodePredicateBase *nodePredicate)
 Sets the node predicate and triggers a model update. More...
 
const mitk::NodePredicateBase * GetNodePredicate () const
 Returns the currently set node predicate. More...
 

Static Public Member Functions

static void AddNodeToHistory (mitk::DataNode *node)
 Adds a node to the global selection history. More...
 
static void ResetHistory ()
 Clears the entire selection history. More...
 

Protected Member Functions

void UpdateModelData () override
 
- Protected Member Functions inherited from QmitkAbstractDataStorageModel
 QmitkAbstractDataStorageModel (QObject *parent=nullptr)
 
 QmitkAbstractDataStorageModel (mitk::DataStorage *dataStorage, QObject *parent=nullptr)
 

Additional Inherited Members

- Protected Attributes inherited from QmitkDataStorageDefaultListModel
std::vector< mitk::DataNode::Pointer > m_DataNodes
 
- Protected Attributes inherited from QmitkAbstractDataStorageModel
mitk::WeakPointer< mitk::DataStorage > m_DataStorage
 
mitk::NodePredicateBase::ConstPointer m_NodePredicate
 

Detailed Description

DataStorage model that maintains a history of node selections.

This model extends QmitkDataStorageDefaultListModel to present nodes ordered by selection time (LIFO – most recently selected first). The history is maintained as a static list shared across all instances.

Nodes appear in the history only if they satisfy all of the following:

  • The node is still present in the data storage.
  • The node pointer is valid (not expired).
  • Each node appears at most once (duplicates are removed).
See also
QmitkDataStorageDefaultListModel
QmitkDataStorageSelectionHistoryInspector

Definition at line 35 of file QmitkDataStorageHistoryModel.h.

Constructor & Destructor Documentation

◆ QmitkDataStorageHistoryModel()

QmitkDataStorageHistoryModel::QmitkDataStorageHistoryModel ( QObject *  parent)

Constructs the history model.

Parameters
[in]parentThe parent QObject.

Member Function Documentation

◆ AddNodeToHistory()

static void QmitkDataStorageHistoryModel::AddNodeToHistory ( mitk::DataNode *  node)
static

Adds a node to the global selection history.

If the node is already present in the history, the old entry is removed before inserting the node at the front. A nullptr node is silently ignored.

Parameters
[in]nodeThe data node to add. May be nullptr.

◆ ResetHistory()

static void QmitkDataStorageHistoryModel::ResetHistory ( )
static

Clears the entire selection history.

◆ UpdateModelData()

void QmitkDataStorageHistoryModel::UpdateModelData ( )
overrideprotectedvirtual

Reimplemented from QmitkDataStorageDefaultListModel.


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