summaryrefslogtreecommitdiffstats
path: root/qt-models/divetripmodel.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-11-15 20:59:13 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-11-16 08:29:53 -0800
commit8a33c04894d6830885d7f47140962d5fdafd648f (patch)
treead14b83881042f4d9ec2f6dcdcc2db5d9a81fb43 /qt-models/divetripmodel.cpp
parentf0a89759bf38375d32ad70ba4710a98d30a47e5d (diff)
downloadsubsurface-8a33c04894d6830885d7f47140962d5fdafd648f.tar.gz
Cleanup: use DiveTripModelBase::clear() to reset the log
Introduce a DiveTripModelBase::clear() function that cleanly clears all dive data inside a beginResetModel()/endResetModel() pair. Thus, the UI will be cleanly reset and we can remove explicit calls to - graphics->setEmptyState() - mainTab->clearTabs() - mainTab->clearTabs() - diveList->reload() from MainWindow::closeCurrentFile(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/divetripmodel.cpp')
-rw-r--r--qt-models/divetripmodel.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp
index d8166d2eb..5fedd432f 100644
--- a/qt-models/divetripmodel.cpp
+++ b/qt-models/divetripmodel.cpp
@@ -372,6 +372,13 @@ void DiveTripModelBase::resetModel(DiveTripModelBase::Layout layout)
currentModel.reset(new DiveTripModelList);
}
+void DiveTripModelBase::clear()
+{
+ beginResetModel();
+ clear_dive_file_data();
+ endResetModel();
+}
+
DiveTripModelBase::DiveTripModelBase(QObject *parent) : QAbstractItemModel(parent)
{
}