Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
qMRMLItemDelegate.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Kitware Inc.
6
7 See COPYRIGHT.txt
8 or http://www.slicer.org/copyright/copyright.txt for details.
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 This file was originally developed by Julien Finet, Kitware Inc.
17 and was partially funded by NIH grant 3P41RR013218-12S1
18
19==============================================================================*/
20
21#ifndef __qMRMLItemDelegate_h
22#define __qMRMLItemDelegate_h
23
24// Qt includes
25#include <QStyledItemDelegate>
26
27// CTK includes
28class ctkDoubleSpinBox;
29
30// qMRML includes
31#include "qMRMLWidgetsExport.h"
32
40class QMRML_WIDGETS_EXPORT qMRMLItemDelegate: public QStyledItemDelegate
41{
42 Q_OBJECT
43public:
44 qMRMLItemDelegate(QObject *parent = nullptr);
46 typedef QStyledItemDelegate Superclass;
47
48 bool isColor(const QModelIndex& index)const;
49 int colorRole(const QModelIndex& index)const;
50 bool is0To1Value(const QModelIndex& index)const;
51
52 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
53 const QModelIndex &index) const override;
54
55 void setEditorData(QWidget *editor, const QModelIndex &index) const override;
56 void setModelData(QWidget *editor, QAbstractItemModel *model,
57 const QModelIndex &index) const override;
58
59 QSize sizeHint(const QStyleOptionViewItem &option,
60 const QModelIndex &index) const override;
61
62 void updateEditorGeometry(QWidget *editor,
63 const QStyleOptionViewItem &option, const QModelIndex &index) const override;
64
65 bool eventFilter(QObject *object, QEvent *event) override;
66
67 // We make initStyleOption public so it can be used by qMRMLTreeView
68 using QStyledItemDelegate::initStyleOption;
69
70protected slots:
73
74protected:
75 ctkDoubleSpinBox* DummySpinBox;
76};
77
78#endif
Item Delegate for MRML properties Use custom widgets for properties such as colors,...
bool isColor(const QModelIndex &index) const
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
~qMRMLItemDelegate() override
bool eventFilter(QObject *object, QEvent *event) override
void setEditorData(QWidget *editor, const QModelIndex &index) const override
QStyledItemDelegate Superclass
ctkDoubleSpinBox * DummySpinBox
int colorRole(const QModelIndex &index) const
bool is0To1Value(const QModelIndex &index) const
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
qMRMLItemDelegate(QObject *parent=nullptr)