Dive list: clear dive data via the filter model

The UI talks to the filter model. Therefore route clearing of
data through that model instead of accessing the source model
directly.

This will allow us to remove the DiveTripModel::instance()
function and makes control flow less "jumpy".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-12-09 15:22:02 +01:00 committed by Dirk Hohndel
parent 358fddd24e
commit e7dafe36aa
3 changed files with 8 additions and 1 deletions

View file

@ -69,6 +69,7 @@
#include "qt-models/cylindermodel.h"
#include "qt-models/divepicturemodel.h"
#include "qt-models/diveplannermodel.h"
#include "qt-models/filtermodels.h"
#include "qt-models/tankinfomodel.h"
#include "qt-models/weightsysteminfomodel.h"
#include "qt-models/yearlystatisticsmodel.h"
@ -650,7 +651,7 @@ void MainWindow::closeCurrentFile()
{
/* free the dives and trips */
clear_git_id();
DiveTripModelBase::instance()->clear();
MultiFilterSortModel::instance()->clear();
setCurrentFile(nullptr);
diveList->setSortOrder(DiveTripModelBase::NR, Qt::DescendingOrder);
MapWidget::instance()->reload();