Buggy room filtering

This commit is contained in:
miruka 2020-04-30 14:28:12 -04:00
parent fcf88209f2
commit 19fe1c4e7b
3 changed files with 13 additions and 2 deletions

View File

@ -5,7 +5,6 @@
- update glass theme - update glass theme
- back/front buttons in small window - back/front buttons in small window
- minimum sizes - minimum sizes
- filter
- save/restore swipeview current rooms for accounts - save/restore swipeview current rooms for accounts
- lag when switching accounts - lag when switching accounts
- message delegate too tall - message delegate too tall

View File

@ -39,6 +39,7 @@ HDrawer {
RoomList { RoomList {
id: roomList id: roomList
clip: true clip: true
filter: filterRoomsField.text
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true

View File

@ -2,12 +2,13 @@
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import SortFilterProxyModel 0.2
import ".." import ".."
import "../Base" import "../Base"
HListView { HListView {
id: roomList id: roomList
model: ModelStore.get("every_room") model: filter ? proxyModel : proxyModel.sourceModel
section.property: "for_account" section.property: "for_account"
section.labelPositioning: section.labelPositioning:
@ -23,6 +24,7 @@ HListView {
} }
property string filter: ""
readonly property var sectionIndice: { readonly property var sectionIndice: {
const sections = {} const sections = {}
const accounts = ModelStore.get("accounts") const accounts = ModelStore.get("accounts")
@ -95,6 +97,15 @@ HListView {
} }
} }
HSortFilterProxyModel {
id: proxyModel
sourceModel: ModelStore.get("every_room")
filters: ExpressionFilter {
expression: utils.filterMatches(filter, model.display_name)
}
}
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
z: -100 z: -100