Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
List of all members | Public Types | Properties | Public Member Functions | Protected Slots | Protected Member Functions | Static Protected Member Functions | Protected Attributes
qMRMLColorModel Class Reference

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

Inheritance diagram for qMRMLColorModel:
Inheritance graph
[legend]
Collaboration diagram for qMRMLColorModel:
Collaboration graph
[legend]

Public Types

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

Properties

int checkableColumn
 
int colorColumn
 
int labelColumn
 
bool 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)
 
 ~qMRMLColorModel () override
 

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.

Member Enumeration Documentation

◆ ItemDataRole

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

Enumerator
ColorEntryRole 
PointerRole 
ColorRole 

Definition at line 79 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

bool 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 155 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 161 of file qMRMLColorModel.h.

◆ qcolorFromItem()

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

Definition at line 167 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)

◆ 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

Member Data Documentation

◆ d_ptr

QScopedPointer<qMRMLColorModelPrivate> qMRMLColorModel::d_ptr
protected

Definition at line 147 of file qMRMLColorModel.h.


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