21 #ifndef __qMRMLItemDelegate_h 22 #define __qMRMLItemDelegate_h 25 #include <QStyledItemDelegate> 28 class ctkDoubleSpinBox;
31 #include "qMRMLWidgetsExport.h" 48 bool isColor(
const QModelIndex& index)
const;
49 int colorRole(
const QModelIndex& index)
const;
50 bool is0To1Value(
const QModelIndex& index)
const;
52 QWidget *createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
53 const QModelIndex &index)
const;
55 void setEditorData(QWidget *editor,
const QModelIndex &index)
const;
56 void setModelData(QWidget *editor, QAbstractItemModel *model,
57 const QModelIndex &index)
const;
59 virtual QSize sizeHint(
const QStyleOptionViewItem &option,
60 const QModelIndex &index)
const;
62 void updateEditorGeometry(QWidget *editor,
63 const QStyleOptionViewItem &option,
const QModelIndex &index)
const;
65 virtual bool eventFilter(QObject *
object, QEvent *event);
68 using QStyledItemDelegate::initStyleOption;
71 void commitSenderData();
72 void commitAndClose();
ctkDoubleSpinBox * DummySpinBox
Item Delegate for MRML properties Use custom widgets for properties such as colors, opacities... If an index has Qt::DecorationRole set to a QColor, its editor will then be a ctkColorPickerButton linked to a color picker dialog on click If an index has a Qt::EditRole set to a QString that exactly is on the form X.YY where X is 0 or 1 and Y is a digit (0 to 9), then the editor will be a ctkDoubleSpinBox with a slider popping up on mouse hover.
QStyledItemDelegate Superclass