21 #ifndef __qMRMLColorModel_h 22 #define __qMRMLColorModel_h 25 #include <QStandardItemModel> 29 #include <ctkVTKObject.h> 32 #include "qMRMLWidgetsExport.h" 39 class qMRMLColorModelPrivate;
47 Q_PROPERTY(
bool noneEnabled READ noneEnabled WRITE setNoneEnabled)
54 Q_PROPERTY(
int colorColumn READ colorColumn WRITE setColorColumn)
59 Q_PROPERTY(
int labelColumn READ labelColumn WRITE setLabelColumn)
64 Q_PROPERTY(
int opacityColumn READ opacityColumn WRITE setOpacityColumn)
70 Q_PROPERTY(
int checkableColumn READ checkableColumn WRITE setCheckableColumn)
80 ColorEntryRole = Qt::UserRole,
91 void setNoneEnabled(
bool enable);
92 bool noneEnabled()
const;
94 int colorColumn()
const;
95 void setColorColumn(
int column);
97 int labelColumn()
const;
98 void setLabelColumn(
int column);
100 int opacityColumn()
const;
101 void setOpacityColumn(
int column);
103 int checkableColumn()
const;
104 void setCheckableColumn(
int column);
109 inline int colorFromIndex(
const QModelIndex &index)
const;
113 int colorFromItem(QStandardItem* item)
const;
115 QStandardItem* itemFromColor(
int color,
int column = 0)
const;
116 QModelIndexList indexes(
int color)
const;
118 inline QColor qcolorFromIndex(
const QModelIndex& nodeIndex)
const;
119 inline QColor qcolorFromItem(QStandardItem* nodeItem)
const;
120 QColor qcolorFromColor(
int color)
const;
124 QString nameFromColor(
int colorEntry)
const;
127 int colorFromName(
const QString& name)
const;
131 virtual QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const;
134 void onMRMLColorNodeModified(vtkObject* node);
135 void onItemChanged(QStandardItem * item);
140 virtual void updateItemFromColor(QStandardItem* item,
int color,
int column);
141 virtual void updateColorFromItem(
int color, QStandardItem* item);
142 virtual void updateNode();
144 static void onMRMLNodeEvent(vtkObject* vtk_obj,
unsigned long event,
145 void* client_data,
void* call_data);
147 QScopedPointer<qMRMLColorModelPrivate>
d_ptr;
QColor qcolorFromIndex(const QModelIndex &nodeIndex) const
QScopedPointer< qMRMLColorModelPrivate > d_ptr
int colorFromItem(QStandardItem *item) const
QColor qcolorFromItem(QStandardItem *nodeItem) const
MRML logic class for color manipulation.
QColor qcolorFromColor(int color) const
Abstract MRML node to represent color information.
QAbstractItemModel Superclass
int colorFromIndex(const QModelIndex &index) const
Abstract Superclass for all specific types of MRML nodes.