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

Method data

Modules/QtWidgets/src/QmitkDataStorageTableModel.cpp:127–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127QVariant QmitkDataStorageTableModel::data(const QModelIndex &index, int role) const
128{
129 QVariant data;
130
131 if (index.isValid() && !m_NodeSet.empty())
132 {
133 mitk::DataNode::Pointer node = m_NodeSet.at(index.row());
134
135 std::string nodeName = node->GetName();
136 if (nodeName.empty())
137 nodeName = "unnamed";
138
139 // get name
140 if (index.column() == 0)
141 {
142 // get name of node (may also be edited)
143 if (role == Qt::DisplayRole || role == Qt::EditRole)
144 {
145 data = QString::fromStdString(nodeName);
146 }
147 else if (role == QmitkDataNodeRole)
148 {
149 data = QVariant::fromValue(node);
150 }
151 }
152 else if (index.column() == 1)
153 {
154 QmitkNodeDescriptor *nodeDescriptor = QmitkNodeDescriptorManager::GetInstance()->GetDescriptor(node);
155
156 // get type property of mitk::BaseData
157 if (role == Qt::DisplayRole)
158 {
159 data = nodeDescriptor->GetNameOfClass();
160 }
161 // show some nice icons for datatype
162 else if (role == Qt::DecorationRole)
163 {
164 data = nodeDescriptor->GetIcon(node);
165 }
166 }
167 else if (index.column() == 2)
168 {
169 // get visible property of mitk::BaseData
170 bool visibility = false;
171
172 if (node->GetVisibility(visibility, nullptr) && role == Qt::CheckStateRole)
173 {
174 data = (visibility ? Qt::Checked : Qt::Unchecked);
175 } // node->GetVisibility(visibility, 0) && role == Qt::CheckStateRole
176
177 } // index.column() == 2
178
179 } // index.isValid() && !m_NodeSet.empty()
180 return data;
181}
182
183//# Public SETTERS
184void QmitkDataStorageTableModel::SetPredicate(mitk::NodePredicateBase *_Predicate)

Callers

nothing calls this directly

Calls 8

atMethod · 0.80
GetVisibilityMethod · 0.80
emptyMethod · 0.45
rowMethod · 0.45
GetNameMethod · 0.45
GetDescriptorMethod · 0.45
GetNameOfClassMethod · 0.45
GetIconMethod · 0.45

Tested by

no test coverage detected