MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
QmitkUSZonesDataModel Class Reference

Implementation of the QAbstractTableModel for ultrasound risk zones. This class manages the data model for the QmitkUSZoneManagementWidget. It provides consistency between the table in QmitkUSZoneManagementWidget and the DataStorage. More...

#include <QmitkUSZonesDataModel.h>

Inheritance diagram for QmitkUSZonesDataModel:

Public Types

typedef std::vector< mitk::DataNode::Pointer > DataNodeVector
 

Public Member Functions

 QmitkUSZonesDataModel (QObject *parent=nullptr)
 
 ~QmitkUSZonesDataModel () override
 
void SetDataStorage (mitk::DataStorage::Pointer dataStorage, mitk::DataNode::Pointer baseNode)
 Set data storage and base node for the zone nodes of this model. The node event listeners will only recognize nodes which are children of the given base node.
 
void AddNode (const mitk::DataNode *)
 
void RemoveNode (const mitk::DataNode *)
 
void ChangeNode (const mitk::DataNode *)
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 Return number of rows of the model.
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 Return number of columns (3) of the model.
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 Return names for the columns, numbers for the rows and invalid for DisplayRole.
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 Return selectable and enabled for column 1 (size); selectable, enabled and editable for every other column.
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 Return model data of the selected cell.
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 Set model data for the selected cell.
 
bool insertRows (int row, int count, const QModelIndex &parent=QModelIndex()) override
 Insert empty rows into the model (creates zone nodes).
 
bool removeRows (int row, int count, const QModelIndex &parent=QModelIndex()) override
 Remove given rows from the model.
 
virtual bool removeRows (int row, int count, const QModelIndex &parent, bool removeFromDataStorage)
 Remove given rows from the model.
 

Protected Attributes

DataNodeVector m_ZoneNodes
 
mitk::DataStorage::Pointer m_DataStorage
 
mitk::DataNode::Pointer m_BaseNode
 

Detailed Description

Implementation of the QAbstractTableModel for ultrasound risk zones. This class manages the data model for the QmitkUSZoneManagementWidget. It provides consistency between the table in QmitkUSZoneManagementWidget and the DataStorage.

Definition at line 28 of file QmitkUSZonesDataModel.h.

Member Typedef Documentation

◆ DataNodeVector

std::vector<mitk::DataNode::Pointer> QmitkUSZonesDataModel::DataNodeVector

Definition at line 33 of file QmitkUSZonesDataModel.h.

Constructor & Destructor Documentation

◆ QmitkUSZonesDataModel()

QmitkUSZonesDataModel::QmitkUSZonesDataModel ( QObject * parent = nullptr)
explicit

Definition at line 22 of file QmitkUSZonesDataModel.cpp.

◆ ~QmitkUSZonesDataModel()

QmitkUSZonesDataModel::~QmitkUSZonesDataModel ( )
override

Definition at line 30 of file QmitkUSZonesDataModel.cpp.

Member Function Documentation

◆ AddNode()

void QmitkUSZonesDataModel::AddNode ( const mitk::DataNode * node)

Definition at line 55 of file QmitkUSZonesDataModel.cpp.

◆ ChangeNode()

void QmitkUSZonesDataModel::ChangeNode ( const mitk::DataNode * node)

Definition at line 108 of file QmitkUSZonesDataModel.cpp.

◆ columnCount()

int QmitkUSZonesDataModel::columnCount ( const QModelIndex & parent = QModelIndex()) const
override

Return number of columns (3) of the model.

Definition at line 135 of file QmitkUSZonesDataModel.cpp.

◆ data()

QVariant QmitkUSZonesDataModel::data ( const QModelIndex & index,
int role = Qt::DisplayRole ) const
override

Return model data of the selected cell.

Definition at line 168 of file QmitkUSZonesDataModel.cpp.

◆ flags()

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

Return selectable and enabled for column 1 (size); selectable, enabled and editable for every other column.

Definition at line 161 of file QmitkUSZonesDataModel.cpp.

◆ headerData()

QVariant QmitkUSZonesDataModel::headerData ( int section,
Qt::Orientation orientation,
int role = Qt::DisplayRole ) const
override

Return names for the columns, numbers for the rows and invalid for DisplayRole.

Definition at line 140 of file QmitkUSZonesDataModel.cpp.

◆ insertRows()

bool QmitkUSZonesDataModel::insertRows ( int row,
int count,
const QModelIndex & parent = QModelIndex() )
override

Insert empty rows into the model (creates zone nodes).

Definition at line 287 of file QmitkUSZonesDataModel.cpp.

◆ RemoveNode()

void QmitkUSZonesDataModel::RemoveNode ( const mitk::DataNode * node)

Definition at line 86 of file QmitkUSZonesDataModel.cpp.

◆ removeRows() [1/2]

bool QmitkUSZonesDataModel::removeRows ( int row,
int count,
const QModelIndex & parent,
bool removeFromDataStorage )
virtual

Remove given rows from the model.

Parameters
removeFromDataStoragezone nodes are removed from the data storage too, if this is set to true

Definition at line 306 of file QmitkUSZonesDataModel.cpp.

◆ removeRows() [2/2]

bool QmitkUSZonesDataModel::removeRows ( int row,
int count,
const QModelIndex & parent = QModelIndex() )
override

Remove given rows from the model.

Definition at line 301 of file QmitkUSZonesDataModel.cpp.

◆ rowCount()

int QmitkUSZonesDataModel::rowCount ( const QModelIndex & parent = QModelIndex()) const
override

Return number of rows of the model.

Definition at line 130 of file QmitkUSZonesDataModel.cpp.

◆ setData()

bool QmitkUSZonesDataModel::setData ( const QModelIndex & index,
const QVariant & value,
int role = Qt::EditRole )
override

Set model data for the selected cell.

Definition at line 237 of file QmitkUSZonesDataModel.cpp.

◆ SetDataStorage()

void QmitkUSZonesDataModel::SetDataStorage ( mitk::DataStorage::Pointer dataStorage,
mitk::DataNode::Pointer baseNode )

Set data storage and base node for the zone nodes of this model. The node event listeners will only recognize nodes which are children of the given base node.

Parameters
dataStorageDataStorage where the zone nodes will be contained
baseNodeDataNode which is source node of the zone nodes

Definition at line 41 of file QmitkUSZonesDataModel.cpp.

Member Data Documentation

◆ m_BaseNode

mitk::DataNode::Pointer QmitkUSZonesDataModel::m_BaseNode
protected

Definition at line 85 of file QmitkUSZonesDataModel.h.

◆ m_DataStorage

mitk::DataStorage::Pointer QmitkUSZonesDataModel::m_DataStorage
protected

Definition at line 84 of file QmitkUSZonesDataModel.h.

◆ m_ZoneNodes

DataNodeVector QmitkUSZonesDataModel::m_ZoneNodes
protected

Definition at line 82 of file QmitkUSZonesDataModel.h.


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