Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkInitialValuesDelegate Class Reference

Toolkit includes. More...

#include <QmitkInitialValuesDelegate.h>

Inheritance diagram for QmitkInitialValuesDelegate:
Collaboration diagram for QmitkInitialValuesDelegate:

Public Member Functions

 QmitkInitialValuesDelegate (QObject *parent=nullptr)
 Constructs a QmitkInitialValuesDelegate. More...
 
QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 Creates an appropriate editor widget based on the value type. More...
 
void setEditorData (QWidget *editor, const QModelIndex &index) const override
 Populates the editor with data from the model. More...
 
void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
 Transfers data from the editor back to the model. More...
 
void setDataStorage (mitk::DataStorage *storage)
 Sets the data storage used to populate the image selection combo box. More...
 
void setNodePredicate (mitk::NodePredicateBase *predicate)
 Sets the node predicate used to filter images in the data storage. More...
 

Protected Member Functions

int valueType (const QModelIndex &index) const
 Determines the value type for the given index. More...
 

Protected Attributes

mitk::DataStorage::Pointer m_Storage
 Data storage used as source for potential initial value images. More...
 
mitk::NodePredicateBase::Pointer m_Predicate
 Predicate used to filter for valid initial value images in the data storage. More...
 

Detailed Description

Toolkit includes.

Item delegate for rendering and editing the initial value source of a model parameter.

This delegate supports two value types determined by the Qt::UserRole data of the index:

  • Type 0 (scalar): The edit role data is a double, and a standard spin box editor is used.
  • Type 1 (image): The edit role data is a void pointer to a mitk::DataNode. A QmitkDataStorageComboBox is used to select an image node from the configured data storage.
See also
QmitkInitialValuesModel
QmitkInitialValuesTypeDelegate
QmitkInitialValuesManagerWidget

Definition at line 39 of file QmitkInitialValuesDelegate.h.

Constructor & Destructor Documentation

◆ QmitkInitialValuesDelegate()

QmitkInitialValuesDelegate::QmitkInitialValuesDelegate ( QObject *  parent = nullptr)

Constructs a QmitkInitialValuesDelegate.

Parameters
[in]parentOptional parent QObject.

Member Function Documentation

◆ createEditor()

QWidget* QmitkInitialValuesDelegate::createEditor ( QWidget *  parent,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
override

Creates an appropriate editor widget based on the value type.

For scalar types (type 0), delegates to QStyledItemDelegate::createEditor(). For image types (type 1), creates a QmitkDataStorageComboBox filtered by the configured node predicate.

Parameters
[in]parentThe parent widget for the editor.
[in]optionStyle options for the item.
[in]indexThe model index of the item being edited.
Returns
The newly created editor widget.

◆ setDataStorage()

void QmitkInitialValuesDelegate::setDataStorage ( mitk::DataStorage *  storage)

Sets the data storage used to populate the image selection combo box.

Parameters
[in]storagePointer to the DataStorage instance.

◆ setEditorData()

void QmitkInitialValuesDelegate::setEditorData ( QWidget *  editor,
const QModelIndex &  index 
) const
override

Populates the editor with data from the model.

For scalar types, delegates to QStyledItemDelegate. For image types, finds and selects the corresponding data node in the combo box.

Parameters
[in]editorThe editor widget to populate.
[in]indexThe model index of the item.

◆ setModelData()

void QmitkInitialValuesDelegate::setModelData ( QWidget *  editor,
QAbstractItemModel *  model,
const QModelIndex &  index 
) const
override

Transfers data from the editor back to the model.

For image types, stores the selected data node pointer. For scalar types, delegates to QStyledItemDelegate.

Parameters
[in]editorThe editor widget containing the new value.
[in,out]modelThe abstract item model to update.
[in]indexThe model index of the item.

◆ setNodePredicate()

void QmitkInitialValuesDelegate::setNodePredicate ( mitk::NodePredicateBase *  predicate)

Sets the node predicate used to filter images in the data storage.

Parameters
[in]predicatePointer to the predicate for filtering valid initial value images.

◆ valueType()

int QmitkInitialValuesDelegate::valueType ( const QModelIndex &  index) const
protected

Determines the value type for the given index.

Parameters
[in]indexThe model index to query (uses Qt::UserRole data).
Returns
0 for scalar type, 1 for image type.

Member Data Documentation

◆ m_Predicate

mitk::NodePredicateBase::Pointer QmitkInitialValuesDelegate::m_Predicate
protected

Predicate used to filter for valid initial value images in the data storage.

Definition at line 112 of file QmitkInitialValuesDelegate.h.

◆ m_Storage

mitk::DataStorage::Pointer QmitkInitialValuesDelegate::m_Storage
protected

Data storage used as source for potential initial value images.

Definition at line 110 of file QmitkInitialValuesDelegate.h.


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