mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
filter: provide function that returns all shown dives
This will be used by the statistics widget. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
c53bab8965
commit
8758b95881
2 changed files with 18 additions and 0 deletions
|
@ -209,3 +209,20 @@ void DiveFilter::setFilter(const FilterData &data)
|
|||
filterData = data;
|
||||
emit diveListNotifier.filterReset();
|
||||
}
|
||||
|
||||
std::vector<dive *> DiveFilter::visibleDives() const
|
||||
{
|
||||
if (shown_dives <= 0)
|
||||
return {};
|
||||
|
||||
std::vector<dive *> res;
|
||||
res.reserve(shown_dives);
|
||||
|
||||
int i;
|
||||
dive *d;
|
||||
for_each_dive(i, d) {
|
||||
if (!d->hidden_by_filter)
|
||||
res.push_back(d);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
QString shownText() const;
|
||||
int shownDives() const;
|
||||
bool diveSiteMode() const; // returns true if we're filtering on dive site (on mobile always returns false)
|
||||
std::vector<dive *> visibleDives() const;
|
||||
#ifndef SUBSURFACE_MOBILE
|
||||
const QVector<dive_site *> &filteredDiveSites() const;
|
||||
void startFilterDiveSites(QVector<dive_site *> ds);
|
||||
|
|
Loading…
Add table
Reference in a new issue