From b8823acef986579491bdc90b3161772c1a697c16 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Thu, 21 Aug 2014 23:01:56 +0200 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/diveplanner.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'qt-ui/diveplanner.cpp') 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(); } -- cgit v1.2.3-70-g09d2