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

Method data

Modules/RenderWindowManagerUI/src/QmitkDataStorageLayerStackModel.cpp:131–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131QVariant QmitkDataStorageLayerStackModel::data(const QModelIndex& index, int role) const
132{
133 if (!index.isValid() || index.model() != this)
134 {
135 return QVariant();
136 }
137
138 if ((index.row()) < 0 || index.row() >= static_cast<int>(m_TempLayerStack.size()))
139 {
140 return QVariant();
141 }
142
143 RenderWindowLayerUtilities::LayerStack::const_iterator layerStackIt = m_TempLayerStack.begin();
144 std::advance(layerStackIt, index.row());
145 mitk::DataNode* dataNode = layerStackIt->second;
146 if (Qt::CheckStateRole == role && 0 == index.column())
147 {
148 bool visibility = false;
149 dataNode->GetVisibility(visibility, m_BaseRenderer.Lock());
150 if (visibility)
151 {
152 return Qt::Checked;
153 }
154 else
155 {
156 return Qt::Unchecked;
157 }
158 }
159 else if (Qt::DisplayRole == role && 1 == index.column())
160 {
161 return QVariant(QString::fromStdString(dataNode->GetName()));
162 }
163 else if (Qt::ToolTipRole == role)
164 {
165 if (0 == index.column())
166 {
167 return QVariant("Show/hide data node.");
168 }
169 else if (1 == index.column())
170 {
171 return QVariant("Name of the data node.");
172 }
173 }
174 else if (QmitkDataNodeRole == role)
175 {
176 return QVariant::fromValue<mitk::DataNode::Pointer>(mitk::DataNode::Pointer(dataNode));
177 }
178 else if (QmitkDataNodeRawPointerRole == role)
179 {
180 return QVariant::fromValue<mitk::DataNode*>(dataNode);
181 }
182
183 return QVariant();
184}
185
186bool QmitkDataStorageLayerStackModel::setData(const QModelIndex &index, const QVariant &value, int role /*= Qt::EditRole*/)
187{

Callers 15

paintMethod · 0.45
createEditorMethod · 0.45
setEditorDataMethod · 0.45
setModelDataMethod · 0.45
paintMethod · 0.45
editorEventMethod · 0.45
paintMethod · 0.45
editorEventMethod · 0.45
HandleGET_screenshotMethod · 0.45

Calls 6

GetVisibilityMethod · 0.80
rowMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
LockMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected