moment/src/qml/Models/Rooms.qml

33 lines
767 B
QML
Raw Normal View History

2019-07-08 13:52:41 +10:00
// Copyright 2019 miruka
// This file is part of harmonyqml, licensed under LGPLv3.
import QtQuick 2.12
2019-07-05 06:01:44 +10:00
import SortFilterProxyModel 0.2
import "../Base"
2019-07-05 08:53:10 +10:00
HListModel {
sorters: StringSorter {
roleName: "displayName"
}
readonly property ListModel _emptyModel: ListModel {}
function find(userId, category, roomId) {
if (! userId) { return }
let found = rooms.getWhere({userId, roomId, category}, 1)[0]
if (found) { return found }
return {
userId, category, roomId,
displayName: "",
avatarUrl: "",
topic: "",
members: _emptyModel,
typingText: "",
inviterId: "",
loading: true,
}
}
2019-07-05 08:53:10 +10:00
}