mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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:
parent
358fddd24e
commit
e7dafe36aa
3 changed files with 8 additions and 1 deletions
|
@ -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();
|
||||
|
|
|
@ -32,6 +32,11 @@ void MultiFilterSortModel::resetModel(DiveTripModelBase::Layout layout)
|
|||
m->initSelection();
|
||||
}
|
||||
|
||||
void MultiFilterSortModel::clear()
|
||||
{
|
||||
DiveTripModelBase::instance()->clear();
|
||||
}
|
||||
|
||||
// Translate selection into local indexes and re-emit signal
|
||||
void MultiFilterSortModel::selectionChangedSlot(const QVector<QModelIndex> &indexes)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ public:
|
|||
bool lessThan(const QModelIndex &, const QModelIndex &) const override;
|
||||
|
||||
void resetModel(DiveTripModelBase::Layout layout);
|
||||
void clear();
|
||||
signals:
|
||||
void selectionChanged(const QVector<QModelIndex> &indexes);
|
||||
void currentDiveChanged(QModelIndex index);
|
||||
|
|
Loading…
Reference in a new issue