aboutsummaryrefslogtreecommitdiffstats
path: root/profile-widget/profilewidget2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'profile-widget/profilewidget2.cpp')
-rw-r--r--profile-widget/profilewidget2.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index b20e6af51..7b6fb9b65 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -1910,17 +1910,15 @@ void ProfileWidget2::keyDeleteAction()
if ((currentState != ADD && currentState != PLAN) || !plannerModel)
return;
- int selCount = scene()->selectedItems().count();
- if (selCount) {
- QVector<int> selectedIndices;
- Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) {
- if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) {
- selectedIndices.push_back(handleIndex(handler));
- handler->hide();
- }
+ QVector<int> selectedIndices;
+ Q_FOREACH (QGraphicsItem *i, scene()->selectedItems()) {
+ if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler *>(i)) {
+ selectedIndices.push_back(handleIndex(handler));
+ handler->hide();
}
- plannerModel->removeSelectedPoints(selectedIndices);
}
+ if (!selectedIndices.isEmpty())
+ plannerModel->removeSelectedPoints(selectedIndices);
}
void ProfileWidget2::keyEscAction()