diff --git a/qml/form/RoomListForm.qml b/qml/form/RoomListForm.qml index 800bf67..3ce1330 100644 --- a/qml/form/RoomListForm.qml +++ b/qml/form/RoomListForm.qml @@ -13,7 +13,7 @@ import "qrc:/qml/menu" import "qrc:/js/util.js" as Util Item { - property alias listModel: roomListProxyModel.sourceModel + property alias listModel: sortedRoomListModel.sourceModel property int filter: 0 property var enteredRoom: null @@ -50,27 +50,8 @@ Item { } SortFilterProxyModel { - id: roomListProxyModel + id: sortedRoomListModel - filters: [ - RegExpFilter { - roleName: "name" - pattern: searchField.text - caseSensitivity: Qt.CaseInsensitive - }, - ExpressionFilter { - enabled: filter === 1 - expression: unreadCount > 0 - }, - ExpressionFilter { - enabled: filter === 2 - expression: category === 1 || category === 2 || category === 4 - }, - ExpressionFilter { - enabled: filter === 3 - expression: category === 3 || category === 5 - } - ] proxyRoles: ExpressionRole { name: "display" expression: { @@ -93,6 +74,36 @@ Item { ] } + SortFilterProxyModel { + id: roomListProxyModel + + sourceModel: sortedRoomListModel + + filters: [ + RegExpFilter { + roleName: "name" + pattern: searchField.text + caseSensitivity: Qt.CaseInsensitive + }, + ExpressionFilter { + enabled: filter === 1 + expression: unreadCount > 0 + }, + IndexFilter { + enabled: filter === 1 + maximumIndex: 16 + }, + ExpressionFilter { + enabled: filter === 2 + expression: category === 1 || category === 2 || category === 4 + }, + ExpressionFilter { + enabled: filter === 3 + expression: category === 3 || category === 5 + } + ] + } + ListView { Layout.fillWidth: true Layout.fillHeight: true