summaryrefslogtreecommitdiffstats
path: root/qt-models/filtermodels.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models/filtermodels.cpp')
-rw-r--r--qt-models/filtermodels.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/qt-models/filtermodels.cpp b/qt-models/filtermodels.cpp
index bcadce613..ce0d5ff42 100644
--- a/qt-models/filtermodels.cpp
+++ b/qt-models/filtermodels.cpp
@@ -105,7 +105,8 @@ MultiFilterSortModel *MultiFilterSortModel::instance()
}
MultiFilterSortModel::MultiFilterSortModel(QObject *parent) : QSortFilterProxyModel(parent),
- divesDisplayed(0)
+ divesDisplayed(0),
+ diveSiteRefCount(0)
{
setFilterKeyColumn(-1); // filter all columns
setFilterCaseSensitivity(Qt::CaseInsensitive);
@@ -269,15 +270,24 @@ void MultiFilterSortModel::clearFilter()
void MultiFilterSortModel::startFilterDiveSites(QVector<dive_site *> ds)
{
dive_sites = ds;
+ ++diveSiteRefCount;
myInvalidate();
}
void MultiFilterSortModel::stopFilterDiveSites()
{
+ if (--diveSiteRefCount > 0)
+ return;
dive_sites.clear();
myInvalidate();
}
+void MultiFilterSortModel::setFilterDiveSite(QVector<dive_site *> ds)
+{
+ dive_sites = ds;
+ myInvalidate();
+}
+
const QVector<dive_site *> &MultiFilterSortModel::filteredDiveSites() const
{
return dive_sites;