mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
66cbdea8a1
commit
b8823acef9
1 changed files with 10 additions and 2 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue