PartDesign: [skip ci] optimize when removing items from dress-up features
This commit is contained in:
@@ -169,6 +169,7 @@ void TaskChamferParameters::onRefDeleted(void)
|
||||
App::DocumentObject* base = pcChamfer->Base.getValue();
|
||||
// get all chamfer references
|
||||
std::vector<std::string> refs = pcChamfer->Base.getSubValues();
|
||||
setupTransaction();
|
||||
|
||||
// delete the selection backwards to assure the list index keeps valid for the deletion
|
||||
for (int i = selectedList.count() - 1; i > -1; i--) {
|
||||
@@ -177,15 +178,14 @@ void TaskChamferParameters::onRefDeleted(void)
|
||||
int rowNumber = ui->listWidgetReferences->row(selectedList.at(i));
|
||||
// erase the reference
|
||||
refs.erase(refs.begin() + rowNumber);
|
||||
setupTransaction();
|
||||
// update the object
|
||||
pcChamfer->Base.setValue(base, refs);
|
||||
// remove from the list
|
||||
ui->listWidgetReferences->model()->removeRow(rowNumber);
|
||||
}
|
||||
|
||||
// update the object
|
||||
pcChamfer->Base.setValue(base, refs);
|
||||
// recompute the feature
|
||||
pcChamfer->getDocument()->recomputeFeature(pcChamfer);
|
||||
pcChamfer->recomputeFeature();
|
||||
|
||||
// if there is only one item left, it cannot be deleted
|
||||
if (ui->listWidgetReferences->count() == 1) {
|
||||
|
||||
@@ -243,6 +243,7 @@ void TaskDraftParameters::onRefDeleted(void)
|
||||
App::DocumentObject* base = pcDraft->Base.getValue();
|
||||
// get all draft references
|
||||
std::vector<std::string> refs = pcDraft->Base.getSubValues();
|
||||
setupTransaction();
|
||||
|
||||
// delete the selection backwards to assure the list index keeps valid for the deletion
|
||||
for (int i = selectedList.count() - 1; i > -1; i--) {
|
||||
@@ -251,15 +252,14 @@ void TaskDraftParameters::onRefDeleted(void)
|
||||
int rowNumber = ui->listWidgetReferences->row(selectedList.at(i));
|
||||
// erase the reference
|
||||
refs.erase(refs.begin() + rowNumber);
|
||||
setupTransaction();
|
||||
// update the object
|
||||
pcDraft->Base.setValue(base, refs);
|
||||
// remove from the list
|
||||
ui->listWidgetReferences->model()->removeRow(rowNumber);
|
||||
}
|
||||
|
||||
// update the object
|
||||
pcDraft->Base.setValue(base, refs);
|
||||
// recompute the feature
|
||||
pcDraft->getDocument()->recomputeFeature(pcDraft);
|
||||
pcDraft->recomputeFeature();
|
||||
|
||||
// if there is only one item left, it cannot be deleted
|
||||
if (ui->listWidgetReferences->count() == 1) {
|
||||
|
||||
@@ -169,6 +169,7 @@ void TaskFilletParameters::onRefDeleted(void)
|
||||
App::DocumentObject* base = pcFillet->Base.getValue();
|
||||
// get all fillet references
|
||||
std::vector<std::string> refs = pcFillet->Base.getSubValues();
|
||||
setupTransaction();
|
||||
|
||||
// delete the selection backwards to assure the list index keeps valid for the deletion
|
||||
for (int i = selectedList.count()-1; i > -1; i--) {
|
||||
@@ -177,15 +178,14 @@ void TaskFilletParameters::onRefDeleted(void)
|
||||
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);
|
||||
}
|
||||
|
||||
// update the object
|
||||
pcFillet->Base.setValue(base, refs);
|
||||
// recompute the feature
|
||||
pcFillet->getDocument()->recomputeFeature(pcFillet);
|
||||
pcFillet->recomputeFeature();
|
||||
|
||||
// if there is only one item left, it cannot be deleted
|
||||
if (ui->listWidgetReferences->count() == 1) {
|
||||
|
||||
@@ -191,6 +191,7 @@ void TaskThicknessParameters::onRefDeleted(void)
|
||||
App::DocumentObject* base = pcThickness->Base.getValue();
|
||||
// get all thickness references
|
||||
std::vector<std::string> refs = pcThickness->Base.getSubValues();
|
||||
setupTransaction();
|
||||
|
||||
// delete the selection backwards to assure the list index keeps valid for the deletion
|
||||
for (int i = selectedList.count() - 1; i > -1; i--) {
|
||||
@@ -199,15 +200,14 @@ void TaskThicknessParameters::onRefDeleted(void)
|
||||
int rowNumber = ui->listWidgetReferences->row(selectedList.at(i));
|
||||
// erase the reference
|
||||
refs.erase(refs.begin() + rowNumber);
|
||||
setupTransaction();
|
||||
// update the object
|
||||
pcThickness->Base.setValue(base, refs);
|
||||
// remove from the list
|
||||
ui->listWidgetReferences->model()->removeRow(rowNumber);
|
||||
}
|
||||
|
||||
// update the object
|
||||
pcThickness->Base.setValue(base, refs);
|
||||
// recompute the feature
|
||||
pcThickness->getDocument()->recomputeFeature(pcThickness);
|
||||
pcThickness->recomputeFeature();
|
||||
|
||||
// if there is only one item left, it cannot be deleted
|
||||
if (ui->listWidgetReferences->count() == 1) {
|
||||
|
||||
Reference in New Issue
Block a user