diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-01-23 11:46:04 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-04-02 13:53:23 -0700 |
commit | 1e525244e62f2997f69b6e006510b0f66222bae7 (patch) | |
tree | aafb4b7aff54cefe79fb4c2194a88e8e0194f301 | |
parent | d68c3d8ab5353ed736249d705e7683dc8f5d6062 (diff) | |
download | subsurface-1e525244e62f2997f69b6e006510b0f66222bae7.tar.gz |
cleanup: use proper model/view semantics in DivePlannerModel
When clearing the model, use "beginResetModel/endResetModel"
instead of "beginRemoveRows/endRemoveRows".
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | qt-models/diveplannermodel.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index a7be4b975..493188325 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -956,11 +956,9 @@ void DivePlannerPointsModel::clear() bool oldRecalc = setRecalc(false); cylinders.updateDive(&displayed_dive); - if (rowCount() > 0) { - beginRemoveRows(QModelIndex(), 0, rowCount() - 1); - divepoints.clear(); - endRemoveRows(); - } + beginResetModel(); + divepoints.clear(); + endResetModel(); cylinders.clear(); preserved_until.seconds = 0; setRecalc(oldRecalc); |