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

Method OnDeleteGroup

Modules/SegmentationUI/src/QmitkMultiLabelInspector.cpp:931–963  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

929}
930
931void QmitkMultiLabelInspector::OnDeleteGroup()
932{
933 if (!m_AllowLabelModification)
934 mitkThrow() << "QmitkMultiLabelInspector is configured incorrectly. Set AllowLabelModification to true to allow the usage of RemoveGroupInternal.";
935
936 if (m_Segmentation.IsNull())
937 return;
938
939 auto currentIndex = this->m_Controls->view->currentIndex();
940 auto groupIDVariant = currentIndex.data(QmitkMultiLabelTreeModel::ItemModelRole::GroupIDRole);
941
942 if (groupIDVariant.isValid())
943 {
944 auto groupID = groupIDVariant.value<mitk::MultiLabelSegmentation::GroupIndexType>();
945 auto groupName = QString::fromStdString(mitk::LabelSetImageHelper::CreateDisplayGroupName(m_Segmentation, groupID));
946 auto question = QStringLiteral("Do you really want to delete group \"%1\" including all of its labels?").arg(groupName);
947 auto answer = QMessageBox::question(this, QString("Delete group \"%1\"").arg(groupName), question, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
948
949 if (answer != QMessageBox::Yes)
950 return;
951
952 this->RemoveGroupInternal(groupID);
953
954 // this is needed as workaround for (T27307). It circumvents the fact that modifications
955 // of data (here the segmentation) does not directly trigger the modification of the
956 // owning node (see T27307). Therefore other code (like renderers or model views) that e.g.
957 // listens to the datastorage for modification would not get notified.
958 if (m_SegmentationNode.IsNotNull())
959 {
960 m_SegmentationNode->Modified();
961 }
962 }
963};
964
965
966void QmitkMultiLabelInspector::OnContextMenuRequested(const QPoint& /*pos*/)

Callers

nothing calls this directly

Calls 6

RemoveGroupInternalMethod · 0.95
IsNotNullMethod · 0.80
QStringClass · 0.50
IsNullMethod · 0.45
dataMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected