summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets/TabDiveSite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/tab-widgets/TabDiveSite.cpp')
-rw-r--r--desktop-widgets/tab-widgets/TabDiveSite.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveSite.cpp b/desktop-widgets/tab-widgets/TabDiveSite.cpp
index 113f8eafe..7deff3d9d 100644
--- a/desktop-widgets/tab-widgets/TabDiveSite.cpp
+++ b/desktop-widgets/tab-widgets/TabDiveSite.cpp
@@ -83,7 +83,7 @@ void TabDiveSite::on_filterText_textChanged(const QString &text)
model.setFilter(text);
}
-void TabDiveSite::updateFilter()
+QVector<dive_site *> TabDiveSite::selectedDiveSites()
{
const QModelIndexList indexes = ui.diveSites->view()->selectionModel()->selectedIndexes();
QVector<dive_site *> sites;
@@ -92,7 +92,12 @@ void TabDiveSite::updateFilter()
struct dive_site *ds = model.getDiveSite(idx);
sites.append(ds);
}
- MultiFilterSortModel::instance()->startFilterDiveSites(sites);
+ return sites;
+}
+
+void TabDiveSite::updateFilter()
+{
+ MultiFilterSortModel::instance()->setFilterDiveSite(selectedDiveSites());
}
void TabDiveSite::selectionChanged(const QItemSelection &, const QItemSelection &)
@@ -104,7 +109,7 @@ void TabDiveSite::showEvent(QShowEvent *)
{
// If the user switches to the dive site tab and there was already a selection,
// filter on that selection.
- updateFilter();
+ MultiFilterSortModel::instance()->startFilterDiveSites(selectedDiveSites());
}
void TabDiveSite::hideEvent(QHideEvent *)