Planner: Control-Click removes divedatapoint and all following ones

In order to offer a simple way to remove a calculated deco, if Control is pressed
while clicking on the trash can in the dive plan, that point and all following are
removed. This way the user can Ctrl-click on the first calculated waypoint.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2014-08-21 23:01:56 +02:00 committed by Dirk Hohndel
parent 66cbdea8a1
commit b8823acef9

View file

@ -985,6 +985,8 @@ divedatapoint DivePlannerPointsModel::at(int row)
void DivePlannerPointsModel::remove(const QModelIndex &index)
{
int i;
int rows = rowCount();
if (index.column() != REMOVE || rowCount() == 1)
return;
@ -992,8 +994,14 @@ void DivePlannerPointsModel::remove(const QModelIndex &index)
if (!dp.entered)
return;
beginRemoveRows(QModelIndex(), index.row(), index.row());
divepoints.remove(index.row());
if (QApplication::keyboardModifiers() & Qt::ControlModifier) {
beginRemoveRows(QModelIndex(), index.row(), rows - 1);
for (i = rows - 1; i >= index.row(); i--)
divepoints.remove(i);
} else {
beginRemoveRows(QModelIndex(), index.row(), index.row());
divepoints.remove(index.row());
}
endRemoveRows();
}