dive sites: properly reload dive site model on desktop

In 9310d72943, resetting of the dive
sites was moved to DiveTripModelBase::reset(). This seemed like a
good idea, because it means that the location list is reloaded
every time the dive list is reset.

Unfortunately that function is only used on mobile, thus on desktop
the dive site model is not updated. Do that in
MultiFilterSortModel::resetModel(), because this is always called
when the dive list is reset. Desktop differs from mobile in that
two different models are used depending on whether we are in list
or in tree mode.

Fixes #2749

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-04-13 23:04:30 +02:00 committed by Dirk Hohndel
parent b4e0968ed5
commit 0ccc0f04bb
2 changed files with 3 additions and 0 deletions

View file

@ -490,6 +490,7 @@ void DiveTripModelBase::clear()
emit diveListNotifier.numShownChanged();
}
// Currently only used by the mobile models
void DiveTripModelBase::reset()
{
beginResetModel();

View file

@ -6,6 +6,7 @@
#include "core/subsurface-string.h"
#include "core/subsurface-qt/divelistnotifier.h"
#include "qt-models/divetripmodel.h"
#include "qt-models/divelocationmodel.h"
MultiFilterSortModel *MultiFilterSortModel::instance()
{
@ -29,6 +30,7 @@ void MultiFilterSortModel::resetModel(DiveTripModelBase::Layout layout)
connect(model.get(), &DiveTripModelBase::selectionChanged, this, &MultiFilterSortModel::selectionChangedSlot);
connect(model.get(), &DiveTripModelBase::currentDiveChanged, this, &MultiFilterSortModel::currentDiveChangedSlot);
model->initSelection();
LocationInformationModel::instance()->update();
}
void MultiFilterSortModel::clear()