mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
profile: fix logic in keyDeleteAction()
The code took care to not delete planner-points when no points are selected. However, it assumed that all selected objects are planner-points. But then it checked whether the selected object actually is a planner-point. So which is it? Remove the outter check for an empty selection. This makes things more logical and more robust, should there ever be other objects that can be selected. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
1ec0790d50
commit
752724aa1e
1 changed files with 7 additions and 9 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue