#pragma once #include class Room; class RoomListModel : public QAbstractListModel { Q_OBJECT public: enum EventRoles { AliasRole = Qt::UserRole + 1, AvatarRole, JoinStateRole, TopicRole, IdRole, HighlightCountRole, NotificationCountRole, DirectRole, SectionRole }; RoomListModel(QList& rooms); int rowCount(const QModelIndex &parent) const override; QVariant data(const QModelIndex &index, int role) const override; void beginInsertRoom() { beginInsertRows(QModelIndex(), rooms.size(), rooms.size()); } void endInsertRoom() { endInsertRows(); } void fullUpdate() { emit layoutChanged(); } void updateRoom(Room* room); protected: QList& rooms; QHash roleNames() const override; };