Add unread message indicator for room . #6

This commit is contained in:
Black Hat
2018-08-06 23:51:22 +08:00
parent c5a55654a0
commit 9c7defba16
3 changed files with 13 additions and 1 deletions

View File

@@ -159,6 +159,9 @@ QVariant RoomListModel::data(const QModelIndex& index, int role) const {
if (room->highlightCount() > 0) return QBrush(QColor("orange"));
return QVariant();
}
if (role == UnreadCountRole) {
return room->unreadCount();
}
return QVariant();
}
@@ -189,5 +192,6 @@ QHash<int, QByteArray> RoomListModel::roleNames() const {
roles[TopicRole] = "topic";
roles[CategoryRole] = "category";
roles[HighlightRole] = "highlight";
roles[UnreadCountRole] = "unreadCount";
return roles;
}