summaryrefslogtreecommitdiffstats
path: root/qt-models/divelistmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models/divelistmodel.cpp')
-rw-r--r--qt-models/divelistmodel.cpp9
1 files changed, 5 insertions, 4 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;
}