blob: 0c467c67ba3416d93901ced50e3d076c7c0493c9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include <QWidget>
#include <QtCore>
#include "completion/FuzzySearchProxyModel.hpp"
bool FuzzySearchProxyModel::filterAcceptsRow(
int sourceRow, const QModelIndex &sourceParent) const {
QAbstractItemModel *model = sourceModel();
QString filterText = filterRegularExpression().pattern();
for (int col = 0; col < model->columnCount(); ++col) {
QModelIndex index = model->index(sourceRow, col, sourceParent);
QString data = model->data(index, Qt::AccessibleDescriptionRole).toString();
// TODO: Fuzzy eet up
if (data.contains(filterText, Qt::CaseInsensitive)) {
return true;
}
}
return false;
}
|