Working filter field for room members

This commit is contained in:
miruka
2019-07-07 05:49:02 -04:00
parent 1af8c97734
commit 47327c64cf
3 changed files with 28 additions and 22 deletions

View File

@@ -2,6 +2,7 @@ import QtQuick 2.7
import QtQuick.Layouts 1.3
import SortFilterProxyModel 0.2
import "../../Base"
import "../../utils.js" as Utils
HColumnLayout {
property bool collapsed: false
@@ -29,6 +30,13 @@ HColumnLayout {
sorters: StringSorter {
roleName: "displayName"
}
filters: ExpressionFilter {
function filterIt(filter, text) {
return Utils.filterMatches(filter, text)
}
expression: filterIt(filterField.text, displayName)
}
}
delegate: MemberDelegate {}
@@ -43,17 +51,6 @@ HColumnLayout {
placeholderText: qsTr("Filter members")
backgroundColor: theme.sidePane.filterRooms.background
// Without this, if the user types in the field, changes of room, then
// comes back, the field will be empty but the filter still applied.
//Component.onCompleted:
//text = Backend.clients.get(chatPage.userId).getMemberFilter(
//chatPage.category, chatPage.roomId
//)
//onTextChanged: Backend.clients.get(chatPage.userId).setMemberFilter(
//chatPage.category, chatPage.roomId, text
//)
Layout.fillWidth: true
Layout.preferredHeight: theme.bottomElementsHeight
}