MCPcopy Create free account
hub / github.com/MITK/MITK / data

Method data

Modules/RTUI/src/QmitkIsoDoseLevelSetModel.cpp:66–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66QVariant
67 QmitkIsoDoseLevelSetModel::
68 data(const QModelIndex &index, int role) const
69{
70 if(!index.isValid())
71 return QVariant();
72
73 QVariant result;
74
75 if (static_cast<unsigned int>(index.row()) < m_DoseSet->Size())
76 {
77 const mitk::IsoDoseLevel& level = m_DoseSet->GetIsoDoseLevel(static_cast<mitk::IsoDoseLevelSet::IsoLevelIndexType>(index.row()));
78
79 switch(index.column())
80 {
81 case 0:
82 if(role == Qt::EditRole || role == Qt::DecorationRole)
83 {
84 QColor color;
85 color.setRgbF(level.GetColor().GetRed(),level.GetColor().GetGreen(),level.GetColor().GetBlue());
86 result = QVariant(color);
87 }
88 else if (role == Qt::ToolTipRole)
89 {
90 result = QVariant("Color of the iso dose level.");
91 }
92 break;
93 case 1:
94 if(role == Qt::DisplayRole)
95 {
96 if (this->m_showAbsoluteDose)
97 {
98 result = QVariant(QString::number(level.GetDoseValue()*this->m_referenceDose)+QString(" Gy"));
99 }
100 else
101 {
102 result = QVariant(QString::number(level.GetDoseValue()*100)+QString(" %"));
103 }
104 }
105 else if(role == Qt::EditRole)
106 {
107 if (this->m_showAbsoluteDose)
108 {
109 result = QVariant(level.GetDoseValue()*this->m_referenceDose);
110 }
111 else
112 {
113 result = QVariant(level.GetDoseValue()*100);
114 }
115 }
116 else if (role == Qt::ToolTipRole)
117 {
118 result = QVariant("Minimum dose value of this level / Value of the iso line.");
119 }
120 else if (role == Qt::UserRole+1)
121 {
122 result = QVariant(this->m_showAbsoluteDose);
123 }

Callers

nothing calls this directly

Calls 4

QStringClass · 0.50
rowMethod · 0.45
SizeMethod · 0.45
GetColorMethod · 0.45

Tested by

no test coverage detected