Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkLabelColorItemDelegate Class Reference

Item delegate for rendering and editing label colors in a QmitkMultiLabelTreeView. More...

#include <QmitkLabelColorItemDelegate.h>

Inheritance diagram for QmitkLabelColorItemDelegate:
Collaboration diagram for QmitkLabelColorItemDelegate:

Public Member Functions

 QmitkLabelColorItemDelegate (QObject *parent=nullptr)
 Constructs the color item delegate. More...
 
bool editorEvent (QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override
 Handles mouse events for opening the color picker dialog. More...
 
void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 Paints the label color as a filled rectangle. More...
 

Detailed Description

Item delegate for rendering and editing label colors in a QmitkMultiLabelTreeView.

Renders the label color as a filled rectangle in the color column and handles mouse click events to open a color picker dialog for changing the label color.

See also
QmitkMultiLabelTreeView
QmitkMultiLabelTreeModel
QmitkLabelToggleItemDelegate

Definition at line 31 of file QmitkLabelColorItemDelegate.h.

Constructor & Destructor Documentation

◆ QmitkLabelColorItemDelegate()

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

Constructs the color item delegate.

Parameters
[in]parentOptional parent QObject.

Member Function Documentation

◆ editorEvent()

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

Handles mouse events for opening the color picker dialog.

Parameters
[in]eventThe editor event.
[in]modelThe model being edited.
[in]optionThe style option for the item.
[in]indexThe model index of the item.
Returns
True if the event was handled; false otherwise.

◆ paint()

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

Paints the label color as a filled rectangle.

Parameters
[in]painterThe painter used for rendering.
[in]optionThe style option for the item.
[in]indexThe model index of the item.

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