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
qSlicerTerminologyItemDelegate Class Reference

#include <Modules/Loadable/Terminologies/Widgets/qSlicerTerminologyItemDelegate.h>

Inheritance diagram for qSlicerTerminologyItemDelegate:
Collaboration diagram for qSlicerTerminologyItemDelegate:

Public Types

enum  TerminologyItemDataRole {
  TerminologyRole = Qt::UserRole + 9 , DefaultTerminologyRole , NameRole , NameAutoGeneratedRole ,
  ColorRole , ColorAutoGeneratedRole , GeneratedColorRole
}
 

Properties

bool useDecorationRole
 

Public Slots

void setUseDecorationRole (bool useDecorationRole)
 

Public Member Functions

QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
 qSlicerTerminologyItemDelegate (QObject *parent=nullptr)
 
void setEditorData (QWidget *editor, const QModelIndex &index) const override
 
void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
 
void setUserSetCustomNameOrColorCallback (std::function< bool()> callback)
 This can be used for asking the user if he wants to switch to using simple name&color selector.
 
void setUseTerminologySelectorCallback (std::function< bool()> callback)
 This method allow setting a callback function that takes a void* argument and returns bool.
 
void updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
bool useDecorationRole ()
 

Protected Slots

void close ()
 
void commitAndClose ()
 
void commitSenderData ()
 
void userSetCustomNameOrColor ()
 

Protected Attributes

bool UseDecorationRole { true }
 
std::function< bool()> UserSetCustomNameOrColorCallback
 
std::function< bool()> UseTerminologySelectorCallback
 The settings key used to specify whether standard terminologies are used for name column.
 

Detailed Description

Definition at line 33 of file qSlicerTerminologyItemDelegate.h.

Member Enumeration Documentation

◆ TerminologyItemDataRole

Enumerator
TerminologyRole 

Serialized terminology entry.

DefaultTerminologyRole 

Serialized default terminology entry, which is used to initialize the terminology selector if the segment has no terminology yet.

NameRole 

Name of the segment (either custom or auto-generated)

NameAutoGeneratedRole 

Flag indicating whether the selected name is auto-generated form terminology.

ColorRole 

Color of the segment. We do not want to show color in the name cell so we need a custom role.

ColorAutoGeneratedRole 

Flag indicating whether the selected color is the recommended one from the terminology (or the auto-generated color in absence of a recommended color)

GeneratedColorRole 

Auto-generated color that is used if the selected terminology contains no recommended color.

Definition at line 42 of file qSlicerTerminologyItemDelegate.h.

Property Documentation

◆ useDecorationRole

bool qSlicerTerminologyItemDelegate::useDecorationRole
readwrite

Definition at line 38 of file qSlicerTerminologyItemDelegate.h.

Constructor & Destructor Documentation

◆ qSlicerTerminologyItemDelegate()

qSlicerTerminologyItemDelegate::qSlicerTerminologyItemDelegate ( QObject * parent = nullptr)

Member Function Documentation

◆ close

void qSlicerTerminologyItemDelegate::close ( )
protectedslot

◆ commitAndClose

void qSlicerTerminologyItemDelegate::commitAndClose ( )
protectedslot

◆ commitSenderData

void qSlicerTerminologyItemDelegate::commitSenderData ( )
protectedslot

◆ createEditor()

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

◆ setEditorData()

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

◆ setModelData()

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

◆ setUseDecorationRole

void qSlicerTerminologyItemDelegate::setUseDecorationRole ( bool useDecorationRole)
slot

◆ setUserSetCustomNameOrColorCallback()

void qSlicerTerminologyItemDelegate::setUserSetCustomNameOrColorCallback ( std::function< bool()> callback)

This can be used for asking the user if he wants to switch to using simple name&color selector.

◆ setUseTerminologySelectorCallback()

void qSlicerTerminologyItemDelegate::setUseTerminologySelectorCallback ( std::function< bool()> callback)

This method allow setting a callback function that takes a void* argument and returns bool.

◆ updateEditorGeometry()

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

◆ useDecorationRole()

bool qSlicerTerminologyItemDelegate::useDecorationRole ( )

◆ userSetCustomNameOrColor

void qSlicerTerminologyItemDelegate::userSetCustomNameOrColor ( )
protectedslot

Member Data Documentation

◆ UseDecorationRole

bool qSlicerTerminologyItemDelegate::UseDecorationRole { true }
protected

Flag indicating whether the delegate is set on a column that shows the color as decoration role. E.g. the name column in Segment Editor does not show decoration, but the color column in Subject Hierarchy does.

Definition at line 92 of file qSlicerTerminologyItemDelegate.h.

◆ UserSetCustomNameOrColorCallback

std::function<bool()> qSlicerTerminologyItemDelegate::UserSetCustomNameOrColorCallback
protected

Definition at line 88 of file qSlicerTerminologyItemDelegate.h.

◆ UseTerminologySelectorCallback

std::function<bool()> qSlicerTerminologyItemDelegate::UseTerminologySelectorCallback
protected

The settings key used to specify whether standard terminologies are used for name column.

Definition at line 87 of file qSlicerTerminologyItemDelegate.h.


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