mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive sites: add fulltext filter
In the dive site tab, add a fulltext filter. The UI is only a mock up. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
9afea37e15
commit
22fe0c14e8
5 changed files with 34 additions and 7 deletions
|
@ -178,8 +178,14 @@ void LocationInformationModel::diveSiteDivesChanged(struct dive_site *ds)
|
|||
|
||||
bool DiveSiteSortedModel::filterAcceptsRow(int sourceRow, const QModelIndex &source_parent) const
|
||||
{
|
||||
// TODO: filtering
|
||||
return true;
|
||||
if (fullText.isEmpty())
|
||||
return true;
|
||||
|
||||
if (sourceRow < 0 || sourceRow > dive_site_table.nr)
|
||||
return false;
|
||||
struct dive_site *ds = dive_site_table.dive_sites[sourceRow];
|
||||
QString text = QString(ds->name) + QString(ds->description) + QString(ds->notes);
|
||||
return text.contains(fullText, Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
bool DiveSiteSortedModel::lessThan(const QModelIndex &i1, const QModelIndex &i2) const
|
||||
|
@ -272,6 +278,12 @@ void DiveSiteSortedModel::remove(const QModelIndex &index)
|
|||
}
|
||||
#endif // SUBSURFACE_MOBILE
|
||||
|
||||
void DiveSiteSortedModel::setFilter(const QString &text)
|
||||
{
|
||||
fullText = text.trimmed();
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
GeoReferencingOptionsModel *GeoReferencingOptionsModel::instance()
|
||||
{
|
||||
static GeoReferencingOptionsModel *self = new GeoReferencingOptionsModel();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue