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/membermodel.h

41 lines
770 B
C
Raw Normal View History

2021-07-21 16:08:15 -04:00
#pragma once
#include <QAbstractListModel>
class Room;
2022-08-15 21:53:56 -04:00
class MemberModel : public QAbstractListModel {
2021-07-21 16:08:15 -04:00
Q_OBJECT
public:
enum EventRoles {
DisplayNameRole = Qt::UserRole + 1,
AvatarURLRole,
IdRole,
SectionRole
2021-07-21 16:08:15 -04:00
};
2022-08-15 21:53:56 -04:00
int rowCount(const QModelIndex& parent) const override;
2021-07-21 16:08:15 -04:00
2022-08-15 21:53:56 -04:00
QVariant data(const QModelIndex& index, int role) const override;
2021-07-21 16:08:15 -04:00
void beginUpdate(const unsigned int num) {
beginInsertRows(QModelIndex(), 0, num);
}
void endUpdate() {
endInsertRows();
}
void setRoom(Room* room) {
this->room = room;
}
void fullUpdate() {
emit layoutChanged();
}
protected:
Room* room = nullptr;
QHash<int, QByteArray> roleNames() const override;
};