moment/src/qml/SidePane/RoomList.qml

45 lines
1.1 KiB
QML
Raw Normal View History

import QtQuick 2.7
import QtQuick.Layouts 1.3
import SortFilterProxyModel 0.2
import "../Base"
2019-05-14 03:15:03 +10:00
HListView {
property string userId: ""
property string category: ""
id: roomList
2019-07-06 06:55:25 +10:00
spacing: sidePane.collapsed ? 0 : sidePane.normalSpacing
model: SortFilterProxyModel {
2019-07-05 06:01:44 +10:00
sourceModel: rooms
filters: AllOf {
ValueFilter {
roleName: "category"
value: category
}
ValueFilter {
roleName: "userId"
value: userId
}
ExpressionFilter {
expression: {
var filter = paneToolBar.roomFilter.toLowerCase()
var words = filter.split(" ")
var room_name = displayName.toLowerCase()
for (var i = 0; i < words.length; i++) {
if (words[i] && room_name.indexOf(words[i]) == -1) {
return false
}
}
return true
}
}
}
}
delegate: RoomDelegate {}
}