Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkMapPropertyDelegate Class Reference

Item delegate for rendering and editing MatchPoint algorithm meta-properties in a QTableView. More...

#include <QmitkMapPropertyDelegate.h>

Public Member Functions

 QmitkMapPropertyDelegate (QObject *parent=nullptr)
 Constructs the property delegate. More...
 
void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 Paints the delegate for the given model index. More...
 
QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 Creates an appropriate editor widget for the property at the given index. More...
 
void setEditorData (QWidget *editor, const QModelIndex &index) const override
 Populates the editor widget with data from the model. More...
 
void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
 Commits data from the editor widget back to the model. More...
 
void updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 Updates the editor geometry to fit the item's bounding rectangle. More...
 

Protected Member Functions

bool eventFilter (QObject *o, QEvent *e) override
 

Detailed Description

Item delegate for rendering and editing MatchPoint algorithm meta-properties in a QTableView.

This delegate creates appropriate editor widgets (QSpinBox, QDoubleSpinBox, QComboBox, or default QStyledItemDelegate editors) based on the Qt type of the property value. It handles data transfer between the editors and the underlying model (typically a QmitkMAPAlgorithmModel) and commits changes on relevant user interaction events (key release, mouse release, focus, etc.).

Supported property types and their editors:

  • int: QSpinBox
  • float: QDoubleSpinBox (5 decimal places)
  • QStringList: QComboBox (non-editable)
  • Other types: default QStyledItemDelegate editor
See also
QmitkMAPAlgorithmModel, QmitkAlgorithmSettingsConfig

Definition at line 39 of file QmitkMapPropertyDelegate.h.

Constructor & Destructor Documentation

◆ QmitkMapPropertyDelegate()

QmitkMapPropertyDelegate::QmitkMapPropertyDelegate ( QObject *  parent = nullptr)

Constructs the property delegate.

Parameters
[in]parentOptional parent QObject.

Member Function Documentation

◆ createEditor()

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

Creates an appropriate editor widget for the property at the given index.

The editor type is determined by the Qt meta type of the data at the index: QSpinBox for int, QDoubleSpinBox for float, QComboBox for QStringList, or the default delegate editor for other types.

Parameters
[in]parentThe parent widget for the editor.
[in]optionStyle options for the item.
[in]indexThe model index identifying the property to edit.
Returns
The created editor widget, or a QLabel if the data is not editable.

◆ eventFilter()

bool QmitkMapPropertyDelegate::eventFilter ( QObject *  o,
QEvent *  e 
)
overrideprotected

◆ paint()

void QmitkMapPropertyDelegate::paint ( QPainter *  painter,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
override

Paints the delegate for the given model index.

Parameters
[in]painterThe painter to use.
[in]optionStyle options for the item.
[in]indexThe model index to paint.

◆ setEditorData()

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

Populates the editor widget with data from the model.

Parameters
[in]editorThe editor widget to populate.
[in]indexThe model index providing the data.

◆ setModelData()

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

Commits data from the editor widget back to the model.

Parameters
[in]editorThe editor widget containing the user's input.
[in,out]modelThe model to receive the data.
[in]indexThe model index identifying the property being edited.

◆ updateEditorGeometry()

void QmitkMapPropertyDelegate::updateEditorGeometry ( QWidget *  editor,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
override

Updates the editor geometry to fit the item's bounding rectangle.

Parameters
[in]editorThe editor widget to resize.
[in]optionStyle options containing the geometry.
[in]indexThe model index (unused).

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