Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkDoseColorDelegate Class Reference

Item delegate for rendering and editing dose level colors in a QTableView. More...

#include <QmitkDoseColorDelegate.h>

Inheritance diagram for QmitkDoseColorDelegate:
Collaboration diagram for QmitkDoseColorDelegate:

Public Member Functions

 QmitkDoseColorDelegate (QObject *parent=nullptr)
 Constructor. More...
 
bool editorEvent (QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override
 Handles mouse click events to open a color chooser dialog. More...
 
void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 Paints the cell as a solid rectangle filled with the dose color. More...
 

Detailed Description

Item delegate for rendering and editing dose level colors in a QTableView.

This delegate paints a filled rectangle with the dose color and opens a QColorDialog on left-click to allow the user to change the color. It reads and writes color data via the Qt::EditRole.

See also
QmitkIsoDoseLevelSetModel
QmitkDoseValueDelegate
QmitkDoseVisualStyleDelegate

Definition at line 33 of file QmitkDoseColorDelegate.h.

Constructor & Destructor Documentation

◆ QmitkDoseColorDelegate()

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

Constructor.

Parameters
[in]parentOptional parent QObject.

Member Function Documentation

◆ editorEvent()

bool QmitkDoseColorDelegate::editorEvent ( QEvent *  event,
QAbstractItemModel *  model,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
)
override

Handles mouse click events to open a color chooser dialog.

On left mouse button release, opens a QColorDialog initialized with the current color. If the user selects a valid color, it is written back to the model.

Parameters
[in]eventThe event to handle.
[in,out]modelThe model to read from and write to.
[in]optionStyle options for the item.
[in]indexThe model index of the item.
Returns
True if the color was successfully changed.

◆ paint()

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

Paints the cell as a solid rectangle filled with the dose color.

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

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