diff --git a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp index cedb467b50..efa0a967c7 100644 --- a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp @@ -26,6 +26,7 @@ #ifndef _PreComp_ # include # include +# include #endif #include "ui_TaskChamferParameters.h" @@ -169,6 +170,12 @@ void TaskChamferParameters::onRefDeleted(void) // get the list of items to be deleted QList selectedList = ui->listWidgetReferences->selectedItems(); + // if all items are selected, we must stop because one must be kept to avoid that the feature gets broken + if (selectedList.count() == ui->listWidgetReferences->model()->rowCount()) { + QMessageBox::warning(this, tr("Selection error"), tr("At least one item must be kept.")); + return; + } + // delete the selection backwards to assure the list index keeps valid for the deletion for (int i = selectedList.count() - 1; i > -1; i--) { QListWidgetItem* item = selectedList.at(i); diff --git a/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp b/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp index 041d4e76ab..73371a3438 100644 --- a/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp @@ -28,6 +28,7 @@ # include # include # include +# include #endif #include "ui_TaskDraftParameters.h" @@ -243,6 +244,12 @@ void TaskDraftParameters::onRefDeleted(void) // get the list of items to be deleted QList selectedList = ui->listWidgetReferences->selectedItems(); + // if all items are selected, we must stop because one must be kept to avoid that the feature gets broken + if (selectedList.count() == ui->listWidgetReferences->model()->rowCount()) { + QMessageBox::warning(this, tr("Selection error"), tr("At least one item must be kept.")); + return; + } + // delete the selection backwards to assure the list index keeps valid for the deletion for (int i = selectedList.count() - 1; i > -1; i--) { QListWidgetItem* item = selectedList.at(i); diff --git a/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp b/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp index 4bccf952d2..fb44cd8176 100644 --- a/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp @@ -27,6 +27,7 @@ # include # include # include +# include #endif #include "ui_TaskFilletParameters.h" @@ -169,6 +170,12 @@ void TaskFilletParameters::onRefDeleted(void) // get the list of items to be deleted QList selectedList = ui->listWidgetReferences->selectedItems(); + // if all items are selected, we must stop because one must be kept to avoid that the feature gets broken + if (selectedList.count() == ui->listWidgetReferences->model()->rowCount()){ + QMessageBox::warning(this, tr("Selection error"), tr("At least one item must be kept.")); + return; + } + // delete the selection backwards to assure the list index keeps valid for the deletion for (int i = selectedList.count()-1; i > -1; i--) { QListWidgetItem* item = selectedList.at(i); diff --git a/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp b/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp index 8037ee0bfb..a430af13ed 100644 --- a/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp @@ -26,6 +26,7 @@ #ifndef _PreComp_ # include # include +# include #endif #include "ui_TaskThicknessParameters.h" @@ -191,6 +192,12 @@ void TaskThicknessParameters::onRefDeleted(void) // get the list of items to be deleted QList selectedList = ui->listWidgetReferences->selectedItems(); + // if all items are selected, we must stop because one must be kept to avoid that the feature gets broken + if (selectedList.count() == ui->listWidgetReferences->model()->rowCount()) { + QMessageBox::warning(this, tr("Selection error"), tr("At least one item must be kept.")); + return; + } + // delete the selection backwards to assure the list index keeps valid for the deletion for (int i = selectedList.count() - 1; i > -1; i--) { QListWidgetItem* item = selectedList.at(i);