Fix filtering without using regex

This commit is contained in:
Nicolas Werner 2022-04-23 14:53:36 +02:00
parent 8c66945be9
commit eeb48749ae
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
2 changed files with 4 additions and 2 deletions

View file

@ -147,6 +147,7 @@ MemberList::MemberList(const QString &room_id, QObject *parent)
void void
MemberList::setFilterString(const QString &text) MemberList::setFilterString(const QString &text)
{ {
filterString = text;
setFilterFixedString(text); setFilterFixedString(text);
} }
@ -161,6 +162,6 @@ MemberList::sortBy(const MemberSortRoles role)
bool bool
MemberList::filterAcceptsRow(int source_row, const QModelIndex &) const MemberList::filterAcceptsRow(int source_row, const QModelIndex &) const
{ {
return m_model.m_memberList[source_row].first.user_id.contains(filterRegularExpression()) || return m_model.m_memberList[source_row].first.user_id.contains(filterString) ||
m_model.m_memberList[source_row].first.display_name.contains(filterRegularExpression()); m_model.m_memberList[source_row].first.display_name.contains(filterString);
} }

View file

@ -122,5 +122,6 @@ protected:
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
private: private:
QString filterString;
MemberListBackend m_model; MemberListBackend m_model;
}; };