diff --git a/Modules/Loadable/Markups/Widgets/qSlicerSimpleMarkupsWidget.cxx b/Modules/Loadable/Markups/Widgets/qSlicerSimpleMarkupsWidget.cxx index ffa4c114b82..2971398e4d9 100644 --- a/Modules/Loadable/Markups/Widgets/qSlicerSimpleMarkupsWidget.cxx +++ b/Modules/Loadable/Markups/Widgets/qSlicerSimpleMarkupsWidget.cxx @@ -182,6 +182,8 @@ void qSlicerSimpleMarkupsWidget::setCurrentNode(vtkMRMLNode* currentNode) this->qvtkReconnect(d->CurrentMarkupsNode, currentMarkupsNode, vtkCommand::ModifiedEvent, this, SLOT(updateWidget())); this->qvtkReconnect(d->CurrentMarkupsNode, currentMarkupsNode, vtkMRMLMarkupsNode::PointAddedEvent, this, SLOT(onPointAdded())); this->qvtkReconnect(d->CurrentMarkupsNode, currentMarkupsNode, vtkMRMLMarkupsNode::PointRemovedEvent, this, SLOT(updateWidget())); + this->qvtkReconnect(d->CurrentMarkupsNode, currentMarkupsNode, vtkMRMLMarkupsNode::PointModifiedEvent, this, SLOT(updateWidget())); + d->CurrentMarkupsNode = currentMarkupsNode; this->updateWidget(); @@ -623,7 +625,6 @@ void qSlicerSimpleMarkupsWidget::onPointAdded() d->MarkupsControlPointsTableWidget->scrollToBottom(); } - //------------------------------------------------------------------------------ void qSlicerSimpleMarkupsWidget::setMRMLScene(vtkMRMLScene* scene) { diff --git a/Modules/Loadable/Markups/qSlicerMarkupsModuleWidget.cxx b/Modules/Loadable/Markups/qSlicerMarkupsModuleWidget.cxx index fb7f34ff01e..147a73d1f5c 100644 --- a/Modules/Loadable/Markups/qSlicerMarkupsModuleWidget.cxx +++ b/Modules/Loadable/Markups/qSlicerMarkupsModuleWidget.cxx @@ -2131,53 +2131,26 @@ void qSlicerMarkupsModuleWidget::setMRMLMarkupsNode(vtkMRMLMarkupsNode* markupsN this->updateWidgetFromMRML(); } -//----------------------------------------------------------------------------- -void qSlicerMarkupsModuleWidget::onActiveMarkupsNodeLockModifiedEvent() -{ - Q_D(qSlicerMarkupsModuleWidget); - - // get the active list - vtkMRMLNode *mrmlNode = d->activeMarkupTreeView->currentNode(); - if (!mrmlNode) - { - return; - } - vtkMRMLMarkupsNode *markupsNode = vtkMRMLMarkupsNode::SafeDownCast(mrmlNode); - if (!markupsNode) - { - return; - } -} - -//----------------------------------------------------------------------------- -void qSlicerMarkupsModuleWidget::onActiveMarkupsNodeLabelFormatModifiedEvent() -{ - Q_D(qSlicerMarkupsModuleWidget); - if (!d->MarkupsNode) - { - return; - } - d->nameFormatLineEdit->setText(d->MarkupsNode->GetMarkupLabelFormat().c_str()); -} - //----------------------------------------------------------------------------- void qSlicerMarkupsModuleWidget::onActiveMarkupsNodePointModifiedEvent(vtkObject *caller, vtkObject *callData) { // the call data should be the index n - if (caller == nullptr || callData == nullptr) + if (caller == nullptr) { return; } - int *nPtr = nullptr; - int n = -1; - nPtr = reinterpret_cast(callData); - if (nPtr) + int* nPtr = reinterpret_cast(callData); + int n = (nPtr ? *nPtr : -1); + if (n>=0) { - n = *nPtr; + this->updateRow(n); + } + else + { + // batch update finished + this->updateWidgetFromMRML(); } - - this->updateRow(n); } //----------------------------------------------------------------------------- @@ -2207,21 +2180,23 @@ void qSlicerMarkupsModuleWidget::onActiveMarkupsNodePointRemovedEvent(vtkObject { Q_D(qSlicerMarkupsModuleWidget); - // the call data should be the index n - if (caller == nullptr || callData == nullptr) + if (caller == nullptr) { return; } - int *nPtr = nullptr; - int n = -1; - nPtr = reinterpret_cast(callData); - if (nPtr) + // the call data should be the index n + int *nPtr = reinterpret_cast(callData); + int n = (nPtr ? *nPtr : -1); + if (n >= 0) { - n = *nPtr; + d->activeMarkupTableWidget->removeRow(n); + } + else + { + // batch update finished + this->updateWidgetFromMRML(); } - - d->activeMarkupTableWidget->removeRow(n); } //----------------------------------------------------------------------------- diff --git a/Modules/Loadable/Markups/qSlicerMarkupsModuleWidget.h b/Modules/Loadable/Markups/qSlicerMarkupsModuleWidget.h index fba8bd5b32b..a5db1796ca5 100644 --- a/Modules/Loadable/Markups/qSlicerMarkupsModuleWidget.h +++ b/Modules/Loadable/Markups/qSlicerMarkupsModuleWidget.h @@ -202,10 +202,6 @@ public slots: /// Update table when markups node is modified void onActiveMarkupsNodeModifiedEvent(); - /// Enable/disable editing the table if the markups node is un/locked - void onActiveMarkupsNodeLockModifiedEvent(); - /// Update the format text entry from the node - void onActiveMarkupsNodeLabelFormatModifiedEvent(); /// Update the table with the modified point information if the node is active void onActiveMarkupsNodePointModifiedEvent(vtkObject *caller, vtkObject *callData); /// Update the table with the new point information if the node is active