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

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

Inheritance diagram for qMRMLColorModel:
Collaboration diagram for qMRMLColorModel:

Public Types

typedef QAbstractItemModel Superclass
 

Properties

int checkableColumn
 
int colorColumn
 
int labelColumn
 
QVTK_OBJECTbool noneEnabled
 
int opacityColumn
 

Public Member Functions

int checkableColumn () const
 
int colorColumn () const
 
int colorFromIndex (const QModelIndex &index) const
 
int colorFromItem (QStandardItem *item) const
 
int colorFromName (const QString &name) const
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
QModelIndexList indexes (int color) const
 
QStandardItem * itemFromColor (int color, int column=0) const
 
int labelColumn () const
 
vtkMRMLColorNodemrmlColorNode () const
 
QString nameFromColor (int colorEntry) const
 
bool noneEnabled () const
 
int opacityColumn () const
 
QColor qcolorFromColor (int color) const
 
QColor qcolorFromIndex (const QModelIndex &nodeIndex) const
 
QColor qcolorFromItem (QStandardItem *nodeItem) const
 
 qMRMLColorModel (QObject *parent=nullptr)
 
void setCheckableColumn (int column)
 
void setColorColumn (int column)
 
void setLabelColumn (int column)
 
void setMRMLColorNode (vtkMRMLColorNode *node)
 
void setNoneEnabled (bool enable)
 
void setOpacityColumn (int column)
 
void setTerminologyColumn (int column)
 
int terminologyColumn () const
 
void updateRowForColor (int color)
 Update all items in the row of a given color index.
 
 ~qMRMLColorModel () override
 

Static Public Member Functions

static QString terminologyTextForColor (vtkMRMLColorNode *colorNode, int colorIndex, bool simplified=false)
 Assemble human readable text in format ": , in , " from color in color node.
 

Protected Slots

void onItemChanged (QStandardItem *item)
 
void onMRMLColorNodeModified (vtkObject *node)
 

Protected Member Functions

 qMRMLColorModel (qMRMLColorModelPrivate *pimpl, QObject *parent=nullptr)
 
virtual void updateColorFromItem (int color, QStandardItem *item)
 
virtual void updateItemFromColor (QStandardItem *item, int color, int column)
 
virtual void updateNode ()
 

Static Protected Member Functions

static void onMRMLNodeEvent (vtkObject *vtk_obj, unsigned long event, void *client_data, void *call_data)
 

Protected Attributes

QScopedPointer< qMRMLColorModelPrivate > d_ptr
 

Detailed Description

Definition at line 42 of file qMRMLColorModel.h.

Member Typedef Documentation

◆ Superclass

typedef QAbstractItemModel qMRMLColorModel::Superclass

Definition at line 73 of file qMRMLColorModel.h.

Property Documentation

◆ checkableColumn

int qMRMLColorModel::checkableColumn
readwrite

The checkable column adds a checkbox for each entry. Note that the checkboxes are unlinked to the color table node. -1 by default

See also
checkableColumn(), setCheckableColumn(), colorColumn, labelColumn, opacityColumn

Definition at line 70 of file qMRMLColorModel.h.

◆ colorColumn

int qMRMLColorModel::colorColumn
readwrite

The color column contains a Qt::DecorationRole with a pixmap of the color, the ColorRole with the color QColor, the colorName as Qt::TooltipRole 0 by default.

See also
colorColumn(), setColorColumn(), labelColumn, opacityColumn, checkableColumn

Definition at line 54 of file qMRMLColorModel.h.

◆ labelColumn

int qMRMLColorModel::labelColumn
readwrite

The label column contains the colorName as Qt::DisplayRole. 1 by default.

See also
labelColumn(), setLabelColumn(), colorColumn, opacityColumn, checkableColumn

Definition at line 59 of file qMRMLColorModel.h.

◆ noneEnabled

QVTK_OBJECTbool qMRMLColorModel::noneEnabled
readwrite

Definition at line 47 of file qMRMLColorModel.h.

◆ opacityColumn

int qMRMLColorModel::opacityColumn
readwrite

The opacity column contains the color opacity as Qt::DisplayRole 2 by default.

See also
opacityColumn(), setOpacityColumn(), colorColumn, labelColumn, checkableColumn

Definition at line 64 of file qMRMLColorModel.h.

Constructor & Destructor Documentation

◆ qMRMLColorModel() [1/2]

qMRMLColorModel::qMRMLColorModel ( QObject * parent = nullptr)

◆ ~qMRMLColorModel()

qMRMLColorModel::~qMRMLColorModel ( )
override

◆ qMRMLColorModel() [2/2]

qMRMLColorModel::qMRMLColorModel ( qMRMLColorModelPrivate * pimpl,
QObject * parent = nullptr )
protected

Member Function Documentation

◆ checkableColumn()

int qMRMLColorModel::checkableColumn ( ) const

◆ colorColumn()

int qMRMLColorModel::colorColumn ( ) const

◆ colorFromIndex()

int qMRMLColorModel::colorFromIndex ( const QModelIndex & index) const
inline

Return the color entry associated to the index. -1 if the index is not in the model.

See also
colorFromItem(), nameFromColor(), colorFromName()

Definition at line 154 of file qMRMLColorModel.h.

◆ colorFromItem()

int qMRMLColorModel::colorFromItem ( QStandardItem * item) const

Return the color entry associated to the item. -1 if the item is not in the model.

See also
colorFromIndex(), nameFromColor(), colorFromName()

◆ colorFromName()

int qMRMLColorModel::colorFromName ( const QString & name) const

Return the color entry of the first color with name name.

See also
nameFromColor(), colorFromIndex(), colorFromItem()

◆ headerData()

QVariant qMRMLColorModel::headerData ( int section,
Qt::Orientation orientation,
int role = Qt::DisplayRole ) const
override

Overload the header data method for the vertical header so that can return the color index rather than the row

◆ indexes()

QModelIndexList qMRMLColorModel::indexes ( int color) const

◆ itemFromColor()

QStandardItem * qMRMLColorModel::itemFromColor ( int color,
int column = 0 ) const

◆ labelColumn()

int qMRMLColorModel::labelColumn ( ) const

◆ mrmlColorNode()

vtkMRMLColorNode * qMRMLColorModel::mrmlColorNode ( ) const

◆ nameFromColor()

QString qMRMLColorModel::nameFromColor ( int colorEntry) const

Return the name of the color colorEntry

See also
colorFromName(), colorFromIndex(), colorFromItem()

◆ noneEnabled()

bool qMRMLColorModel::noneEnabled ( ) const

◆ onItemChanged

void qMRMLColorModel::onItemChanged ( QStandardItem * item)
protectedslot

◆ onMRMLColorNodeModified

void qMRMLColorModel::onMRMLColorNodeModified ( vtkObject * node)
protectedslot

◆ onMRMLNodeEvent()

static void qMRMLColorModel::onMRMLNodeEvent ( vtkObject * vtk_obj,
unsigned long event,
void * client_data,
void * call_data )
staticprotected

◆ opacityColumn()

int qMRMLColorModel::opacityColumn ( ) const

◆ qcolorFromColor()

QColor qMRMLColorModel::qcolorFromColor ( int color) const

◆ qcolorFromIndex()

QColor qMRMLColorModel::qcolorFromIndex ( const QModelIndex & nodeIndex) const
inline

Definition at line 160 of file qMRMLColorModel.h.

◆ qcolorFromItem()

QColor qMRMLColorModel::qcolorFromItem ( QStandardItem * nodeItem) const
inline

Definition at line 166 of file qMRMLColorModel.h.

◆ setCheckableColumn()

void qMRMLColorModel::setCheckableColumn ( int column)

◆ setColorColumn()

void qMRMLColorModel::setColorColumn ( int column)

◆ setLabelColumn()

void qMRMLColorModel::setLabelColumn ( int column)

◆ setMRMLColorNode()

void qMRMLColorModel::setMRMLColorNode ( vtkMRMLColorNode * node)

◆ setNoneEnabled()

void qMRMLColorModel::setNoneEnabled ( bool enable)

Set/Get NoneEnabled flags An additional item is added into the menu list, where the user can select "None".

◆ setOpacityColumn()

void qMRMLColorModel::setOpacityColumn ( int column)

◆ setTerminologyColumn()

void qMRMLColorModel::setTerminologyColumn ( int column)

◆ terminologyColumn()

int qMRMLColorModel::terminologyColumn ( ) const

◆ terminologyTextForColor()

static QString qMRMLColorModel::terminologyTextForColor ( vtkMRMLColorNode * colorNode,
int colorIndex,
bool simplified = false )
static

Assemble human readable text in format ": , in , " from color in color node.

◆ updateColorFromItem()

virtual void qMRMLColorModel::updateColorFromItem ( int color,
QStandardItem * item )
protectedvirtual

◆ updateItemFromColor()

virtual void qMRMLColorModel::updateItemFromColor ( QStandardItem * item,
int color,
int column )
protectedvirtual

◆ updateNode()

virtual void qMRMLColorModel::updateNode ( )
protectedvirtual

◆ updateRowForColor()

void qMRMLColorModel::updateRowForColor ( int color)

Update all items in the row of a given color index.

Member Data Documentation

◆ d_ptr

QScopedPointer<qMRMLColorModelPrivate> qMRMLColorModel::d_ptr
protected

Definition at line 146 of file qMRMLColorModel.h.


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