Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkPropertyDelegate.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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef QmitkPropertyDelegate_h
18 #define QmitkPropertyDelegate_h
19 
20 #include <MitkQtWidgetsExports.h>
21 
23 #include "mitkBaseProperty.h"
24 
26 #include <QStyledItemDelegate>
27 
29 
36 class MITKQTWIDGETS_EXPORT QmitkPropertyDelegate : public QStyledItemDelegate
37 {
38  Q_OBJECT
39 
40 public:
44  QmitkPropertyDelegate(QObject *parent = nullptr);
45 
49  void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
50 
54  QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
55 
59  void setEditorData(QWidget *editor, const QModelIndex &index) const override;
60 
64  void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
65 
69  void updateEditorGeometry(QWidget *editor,
70  const QStyleOptionViewItem &option,
71  const QModelIndex &index) const override;
72 
73 protected:
74  bool eventFilter(QObject *o, QEvent *e) override;
75 
76 private slots:
80  void commitAndCloseEditor();
81  void showColorDialog();
82  void ComboBoxCurrentIndexChanged(int index);
83  void SpinBoxValueChanged(const QString &value);
84 };
85 
86 #endif /* QMITKPROPERTIESTABLEMODEL_H_ */
#define MITKQTWIDGETS_EXPORT