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
spacing: sidePane.normalSpacing
model: SortFilterProxyModel {
sourceModel: models.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 {}
}