Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkLabelColorItemDelegate.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkLabelColorItemDelegate_h
14 #define QmitkLabelColorItemDelegate_h
15 
16 
17 #include <QStyledItemDelegate>
18 
20 
31 class MITKSEGMENTATIONUI_EXPORT QmitkLabelColorItemDelegate : public QStyledItemDelegate
32 {
33  Q_OBJECT
34 
35 public:
40  explicit QmitkLabelColorItemDelegate(QObject *parent = nullptr);
41 
50  bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option,
51  const QModelIndex &index) override;
52 
59  void paint(QPainter *painter, const QStyleOptionViewItem &option,
60  const QModelIndex &index) const override;
61 };
62 
63 #endif
#define MITKSEGMENTATIONUI_EXPORT
Item delegate for rendering and editing label colors in a QmitkMultiLabelTreeView.
QmitkLabelColorItemDelegate(QObject *parent=nullptr)
Constructs the color item delegate.
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override
Handles mouse events for opening the color picker dialog.
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Paints the label color as a filled rectangle.