Add dedicated HStringFilterModel component

This commit is contained in:
miruka
2020-05-01 00:27:02 -04:00
parent 69a525d317
commit 7418f0fe93
3 changed files with 24 additions and 14 deletions

View File

@@ -13,12 +13,11 @@ HColumnLayout {
id: memberList
clip: true
model: HFilterModel {
model: ModelStore.get(chat.userId, chat.roomId, "members")
model: HStringFilterModel {
sourceModel: ModelStore.get(chat.userId, chat.roomId, "members")
field: "display_name"
filter: filterField.text
delegate: MemberDelegate { width: memberList.width }
acceptItem: item =>
utils.filterMatches(filterField.text, item.display_name)
}
Layout.fillWidth: true
@@ -58,8 +57,6 @@ HColumnLayout {
// declared normally
Component.onCompleted: placeholderText = qsTr("Filter members")
onTextChanged: memberList.model.refilterAll()
Behavior on opacity { HNumberAnimation {} }
}