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.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp
index 72ce90049..c1b8bea83 100644
--- a/qt-models/divelistmodel.cpp
+++ b/qt-models/divelistmodel.cpp
@@ -20,19 +20,17 @@ void DiveListSortModel::updateFilterState()
bool includeNotes = qPrefGeneral::filterFullTextNotes();
Qt::CaseSensitivity cs = qPrefGeneral::filterCaseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive;
- // get the underlying model and re-calculate the filter value for each dive
- DiveListModel *mySourceModel = qobject_cast<DiveListModel *>(sourceModel());
- for (int i = 0; i < mySourceModel->rowCount(); i++) {
- DiveObjectHelper *d = mySourceModel->at(i);
- QString fullText = includeNotes? d->fullText() : d->fullTextNoNotes();
- d->getDive()->hidden_by_filter = !fullText.contains(filterString, cs);
- }
+ int i;
+ struct dive *d;
+ for_each_dive(i, d)
+ d->hidden_by_filter = !diveContainsText(d, filterString, cs, includeNotes);
}
void DiveListSortModel::setSourceModel(QAbstractItemModel *sourceModel)
{
QSortFilterProxyModel::setSourceModel(sourceModel);
}
+
void DiveListSortModel::setFilter(QString f)
{
filterString = f;