From 8f7633eff867e7d5437f9caf24e82f581bf624c0 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 16 Oct 2018 07:56:41 -0400 Subject: Mobile/filtering: full text filter, instead of just dive site Signed-off-by: Dirk Hohndel --- qt-models/divelistmodel.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'qt-models/divelistmodel.cpp') diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp index 76c0db7e3..38c8c86c0 100644 --- a/qt-models/divelistmodel.cpp +++ b/qt-models/divelistmodel.cpp @@ -10,8 +10,9 @@ DiveListSortModel::DiveListSortModel(QObject *parent) : QSortFilterProxyModel(pa void DiveListSortModel::setFilter(QString f) { - setFilterRole(DiveListModel::DiveSiteRole); - setFilterRegExp(f); + setFilterRole(DiveListModel::FullTextRole); + setFilterRegExp(QString(".*%1.*").arg(f)); + setFilterCaseSensitivity(Qt::CaseInsensitive); } void DiveListSortModel::resetFilter() @@ -162,7 +163,7 @@ QVariant DiveListModel::data(const QModelIndex &index, int role) const switch(role) { case DiveRole: return QVariant::fromValue(curr_dive); case DiveDateRole: return (qlonglong)curr_dive->timestamp(); - case DiveSiteRole: return curr_dive->location(); + case FullTextRole: return curr_dive->fullText(); } return QVariant(); @@ -173,7 +174,7 @@ QHash DiveListModel::roleNames() const QHash roles; roles[DiveRole] = "dive"; roles[DiveDateRole] = "date"; - roles[DiveSiteRole] = "site"; + roles[FullTextRole] = "fulltext"; return roles; } -- cgit v1.2.3-70-g09d2