summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-12-24 10:14:37 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-01-07 09:33:52 -0800
commitb5704ddb57d905e66f5f71558bb07b2f165913a9 (patch)
tree822049f06d2c9e97dacb8f306ccd28f1e989943b /qt-models
parent4d06ddd72351f7804acdaec81f0400a735581229 (diff)
downloadsubsurface-b5704ddb57d905e66f5f71558bb07b2f165913a9.tar.gz
Cleanup: Remove MultiFilterSortModel::model
The source-model was cached in MultiFilterSortModel. For simplicity, remove that and simply access via DiveTripModel::instance(). There is only one instance where the cached model was used: when comparing items for sorting. Thus, in indirection is added in a "hot" path. Nevertheless, this will dwarf against the cost of string comparison. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/filtermodels.cpp7
-rw-r--r--qt-models/filtermodels.h1
2 files changed, 3 insertions, 5 deletions
diff --git a/qt-models/filtermodels.cpp b/qt-models/filtermodels.cpp
index 25344b712..785d36123 100644
--- a/qt-models/filtermodels.cpp
+++ b/qt-models/filtermodels.cpp
@@ -84,12 +84,11 @@ MultiFilterSortModel *MultiFilterSortModel::instance()
MultiFilterSortModel::MultiFilterSortModel(QObject *parent) : QSortFilterProxyModel(parent),
divesDisplayed(0),
- curr_dive_site(NULL),
- model(DiveTripModel::instance())
+ curr_dive_site(NULL)
{
setFilterKeyColumn(-1); // filter all columns
setFilterCaseSensitivity(Qt::CaseInsensitive);
- setSourceModel(model);
+ setSourceModel(DiveTripModel::instance());
}
void MultiFilterSortModel::setLayout(DiveTripModel::Layout layout)
@@ -219,7 +218,7 @@ void MultiFilterSortModel::stopFilterDiveSite()
bool MultiFilterSortModel::lessThan(const QModelIndex &i1, const QModelIndex &i2) const
{
// Hand sorting down to the source model.
- return model->lessThan(i1, i2);
+ return DiveTripModel::instance()->lessThan(i1, i2);
}
void MultiFilterSortModel::filterDataChanged(const FilterData& data)
diff --git a/qt-models/filtermodels.h b/qt-models/filtermodels.h
index 61b82be33..442bdec5e 100644
--- a/qt-models/filtermodels.h
+++ b/qt-models/filtermodels.h
@@ -58,7 +58,6 @@ signals:
private:
MultiFilterSortModel(QObject *parent = 0);
struct dive_site *curr_dive_site;
- DiveTripModel *model;
FilterData filterData;
};