diff options
author | Robert C. Helling <helling@atdotde.de> | 2014-08-21 23:01:56 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-08-21 16:16:38 -0500 |
commit | b8823acef986579491bdc90b3161772c1a697c16 (patch) | |
tree | 042beff985c9df979877beef8b00cbc9d0cadf66 | |
parent | 66cbdea8a194ce230a7240923609b7a7c9a91469 (diff) | |
download | subsurface-b8823acef986579491bdc90b3161772c1a697c16.tar.gz |
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>
-rw-r--r-- | qt-ui/diveplanner.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 8e87df0d5..ebaf6f5d1 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -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(); } |