28 Qt::MatchFlags filterMatchFlags,
const QString& filterKey) :
29 QSortFilterProxyModel(parent),
30 filterMatchFlags_(filterMatchFlags),
31 filterKey_(filterKey) {
70 QModelIndex& sourceParent)
const {
72 return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
74 if (filterKeyColumn() == -1)
77 QModelIndex sourceIndex = sourceModel()->index(sourceRow, filterKeyColumn(),
80 if (!sourceIndex.isValid())
83 QString key = sourceModel()->data(sourceIndex, filterRole()).toString();
86 return key.contains(
filterKey_, filterCaseSensitivity());
88 return key.startsWith(
filterKey_, filterCaseSensitivity());
90 return key.endsWith(
filterKey_, filterCaseSensitivity());
Qt::MatchFlags getFilterMatchFlags() const
void setFilterKey(const QString &key)
const QString & getFilterKey() const
MatchFilterCompleterModel(QObject *parent=0, Qt::MatchFlags filterMatchFlags=Qt::MatchStartsWith, const QString &filterKey=QString())
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
Qt::MatchFlags filterMatchFlags_
void setFilterMatchFlags(Qt::MatchFlags flags)
virtual ~MatchFilterCompleterModel()