From b3f530bfb9d099414d833e7b0eb8c71cb3780eca Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 3 Nov 2019 15:04:48 +0100 Subject: Undo: make weight-deletion an undoable action This one is a bit more complicated than weight adding, because the multiple-dive case is not well defined. If multiple dives are selected, this implementation will search for weights that are identical to the weight deleted in the currently shown dive. The position of the weight in the list is ignored. Signed-off-by: Berthold Stoeger --- qt-models/weightmodel.cpp | 12 ------------ qt-models/weightmodel.h | 1 - 2 files changed, 13 deletions(-) (limited to 'qt-models') diff --git a/qt-models/weightmodel.cpp b/qt-models/weightmodel.cpp index ceac7617c..ff0b5c87a 100644 --- a/qt-models/weightmodel.cpp +++ b/qt-models/weightmodel.cpp @@ -29,17 +29,6 @@ weightsystem_t *WeightModel::weightSystemAt(const QModelIndex &index) return &d->weightsystems.weightsystems[index.row()]; } -void WeightModel::remove(QModelIndex index) -{ - if (index.column() != REMOVE || !d) - return; - beginRemoveRows(QModelIndex(), index.row(), index.row()); - rows--; - remove_weightsystem(d, index.row()); - changed = true; - endRemoveRows(); -} - void WeightModel::clear() { updateDive(nullptr); @@ -96,7 +85,6 @@ void WeightModel::passInData(const QModelIndex &index, const QVariant &value) } } - bool WeightModel::setData(const QModelIndex &index, const QVariant &value, int role) { QString vString = value.toString(); diff --git a/qt-models/weightmodel.h b/qt-models/weightmodel.h index bb2c63778..a61217379 100644 --- a/qt-models/weightmodel.h +++ b/qt-models/weightmodel.h @@ -30,7 +30,6 @@ public: public slots: - void remove(QModelIndex index); void weightsystemsReset(const QVector &dives); void weightAdded(dive *d, int pos); void weightRemoved(dive *d, int pos); -- cgit v1.2.3-70-g09d2