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

Method UpdateSelectionModel

Modules/SegmentationUI/src/QmitkMultiLabelInspector.cpp:351–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351void QmitkMultiLabelInspector::UpdateSelectionModel(const LabelValueVectorType& selectedLabels)
352{
353 // create new selection by retrieving the corresponding indexes of the labels
354 QItemSelection newCurrentSelection;
355 for (const auto& labelID : selectedLabels)
356 {
357 QModelIndexList matched = m_Model->match(m_Model->index(0, 0), QmitkMultiLabelTreeModel::ItemModelRole::LabelInstanceValueRole, QVariant(labelID), 1, Qt::MatchRecursive);
358 if (!matched.empty())
359 {
360 newCurrentSelection.select(matched.front(), matched.front());
361 }
362 }
363
364 m_Controls->view->selectionModel()->select(newCurrentSelection, QItemSelectionModel::ClearAndSelect|QItemSelectionModel::Current);
365}
366
367void QmitkMultiLabelInspector::SetSelectedLabel(mitk::MultiLabelSegmentation::LabelValueType selectedLabel)
368{

Callers 1

SetSelectedLabelsMethod · 0.95

Calls 4

matchMethod · 0.80
frontMethod · 0.80
indexMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected