diff options
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/divelistmodel.cpp | 9 | ||||
-rw-r--r-- | qt-models/divelistmodel.h | 2 |
2 files changed, 6 insertions, 5 deletions
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<QObject*>(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<int, QByteArray> DiveListModel::roleNames() const QHash<int, QByteArray> roles; roles[DiveRole] = "dive"; roles[DiveDateRole] = "date"; - roles[DiveSiteRole] = "site"; + roles[FullTextRole] = "fulltext"; return roles; } diff --git a/qt-models/divelistmodel.h b/qt-models/divelistmodel.h index 2773ce33d..c34fb931d 100644 --- a/qt-models/divelistmodel.h +++ b/qt-models/divelistmodel.h @@ -29,7 +29,7 @@ public: enum DiveListRoles { DiveRole = Qt::UserRole + 1, DiveDateRole, - DiveSiteRole + FullTextRole }; static DiveListModel *instance(); |