Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
qMRMLItemDelegate Class Reference

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. More...

#include <Libs/MRML/Widgets/qMRMLItemDelegate.h>

Inheritance diagram for qMRMLItemDelegate:
Collaboration diagram for qMRMLItemDelegate:

Public Types

enum  ItemDataRole { ColorEntryRole = Qt::UserRole , PointerRole , ColorRole }
 
typedef QStyledItemDelegate Superclass
 

Public Member Functions

int colorRole (const QModelIndex &index) const
 
QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
bool eventFilter (QObject *object, QEvent *event) override
 
bool is0To1Value (const QModelIndex &index) const
 
bool isColor (const QModelIndex &index) const
 
 qMRMLItemDelegate (QObject *parent=nullptr)
 
void setEditorData (QWidget *editor, const QModelIndex &index) const override
 
void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
 
QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
void updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
 ~qMRMLItemDelegate () override
 

Protected Slots

void commitAndClose ()
 
void commitSenderData ()
 

Protected Attributes

ctkDoubleSpinBox * DummySpinBox
 

Detailed Description

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.

Definition at line 40 of file qMRMLItemDelegate.h.

Member Typedef Documentation

◆ Superclass

typedef QStyledItemDelegate qMRMLItemDelegate::Superclass

Definition at line 46 of file qMRMLItemDelegate.h.

Member Enumeration Documentation

◆ ItemDataRole

ColorRole is an invisible role that contains the true color (QColor) when Qt::DecorationRole contains a pixmap of the color.

Enumerator
ColorEntryRole 
PointerRole 
ColorRole 

Definition at line 50 of file qMRMLItemDelegate.h.

Constructor & Destructor Documentation

◆ qMRMLItemDelegate()

qMRMLItemDelegate::qMRMLItemDelegate ( QObject * parent = nullptr)

◆ ~qMRMLItemDelegate()

qMRMLItemDelegate::~qMRMLItemDelegate ( )
override

Member Function Documentation

◆ colorRole()

int qMRMLItemDelegate::colorRole ( const QModelIndex & index) const

◆ commitAndClose

void qMRMLItemDelegate::commitAndClose ( )
protectedslot

◆ commitSenderData

void qMRMLItemDelegate::commitSenderData ( )
protectedslot

◆ createEditor()

QWidget * qMRMLItemDelegate::createEditor ( QWidget * parent,
const QStyleOptionViewItem & option,
const QModelIndex & index ) const
override

◆ eventFilter()

bool qMRMLItemDelegate::eventFilter ( QObject * object,
QEvent * event )
override

◆ is0To1Value()

bool qMRMLItemDelegate::is0To1Value ( const QModelIndex & index) const

◆ isColor()

bool qMRMLItemDelegate::isColor ( const QModelIndex & index) const

◆ setEditorData()

void qMRMLItemDelegate::setEditorData ( QWidget * editor,
const QModelIndex & index ) const
override

◆ setModelData()

void qMRMLItemDelegate::setModelData ( QWidget * editor,
QAbstractItemModel * model,
const QModelIndex & index ) const
override

◆ sizeHint()

QSize qMRMLItemDelegate::sizeHint ( const QStyleOptionViewItem & option,
const QModelIndex & index ) const
override

◆ updateEditorGeometry()

void qMRMLItemDelegate::updateEditorGeometry ( QWidget * editor,
const QStyleOptionViewItem & option,
const QModelIndex & index ) const
override

Member Data Documentation

◆ DummySpinBox

ctkDoubleSpinBox* qMRMLItemDelegate::DummySpinBox
protected

Definition at line 83 of file qMRMLItemDelegate.h.


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