[PD] only recompute once per deletion action
see https://forum.freecadweb.org/viewtopic.php?f=19&t=43383&p=370357#p370357
This commit is contained in:
@@ -164,23 +164,29 @@ void TaskFilletParameters::onRefDeleted(void)
|
||||
return;
|
||||
}
|
||||
|
||||
// get the fillet object
|
||||
PartDesign::Fillet* pcFillet = static_cast<PartDesign::Fillet*>(DressUpView->getObject());
|
||||
App::DocumentObject* base = pcFillet->Base.getValue();
|
||||
// get all fillet references
|
||||
std::vector<std::string> refs = pcFillet->Base.getSubValues();
|
||||
|
||||
// delete the selection backwards to assure the list index keeps valid for the deletion
|
||||
for (int i = selectedList.count()-1; i > -1; i--) {
|
||||
// get the fillet object
|
||||
PartDesign::Fillet* pcFillet = static_cast<PartDesign::Fillet*>(DressUpView->getObject());
|
||||
App::DocumentObject* base = pcFillet->Base.getValue();
|
||||
// get all fillet references
|
||||
std::vector<std::string> refs = pcFillet->Base.getSubValues();
|
||||
// the ref index is the same as the listWidgetReferences index
|
||||
// so we can erase using the row number of the element to be deleted
|
||||
int rowNumber = ui->listWidgetReferences->row(selectedList.at(i));
|
||||
// erase the reference
|
||||
refs.erase(refs.begin() + rowNumber);
|
||||
setupTransaction();
|
||||
// update the object
|
||||
pcFillet->Base.setValue(base, refs);
|
||||
// remove from the list
|
||||
ui->listWidgetReferences->model()->removeRow(rowNumber);
|
||||
pcFillet->getDocument()->recomputeFeature(pcFillet);
|
||||
}
|
||||
|
||||
// recompute the feature
|
||||
pcFillet->getDocument()->recomputeFeature(pcFillet);
|
||||
|
||||
// if there is only one item left, it cannot be deleted
|
||||
if (ui->listWidgetReferences->count() == 1) {
|
||||
deleteAction->setEnabled(false);
|
||||
|
||||
Reference in New Issue
Block a user