From 1e525244e62f2997f69b6e006510b0f66222bae7 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 23 Jan 2021 11:46:04 +0100 Subject: [PATCH] cleanup: use proper model/view semantics in DivePlannerModel When clearing the model, use "beginResetModel/endResetModel" instead of "beginRemoveRows/endRemoveRows". Signed-off-by: Berthold Stoeger --- qt-models/diveplannermodel.cpp | 8 +++----- 1 file 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);