Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
trinity/include/roomlistmodel.h
2022-08-15 21:53:56 -04:00

45 lines
899 B
C++

#pragma once
#include <QAbstractListModel>
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<Room*>& 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<Room*>& rooms;
QHash<int, QByteArray> roleNames() const override;
};