matrixion/src/UsersModel.h

27 lines
681 B
C
Raw Normal View History

2020-09-07 12:51:28 +03:00
#pragma once
#include <QAbstractListModel>
class UsersModel : public QAbstractListModel
{
public:
enum Roles
{
2020-11-20 04:38:08 +03:00
AvatarUrl = Qt::UserRole,
DisplayName,
2020-09-07 12:51:28 +03:00
};
UsersModel(const std::string &roomId, QObject *parent = nullptr);
2020-11-20 04:38:08 +03:00
QHash<int, QByteArray> roleNames() const override;
2020-09-07 12:51:28 +03:00
int rowCount(const QModelIndex &parent = QModelIndex()) const override
{
2020-11-20 04:38:08 +03:00
(void)parent;
return roomMembers_.size();
2020-09-07 12:51:28 +03:00
}
QVariant data(const QModelIndex &index, int role) const override;
private:
2020-11-20 04:38:08 +03:00
std::string room_id;
std::vector<std::string> roomMembers_;
2020-09-07 12:51:28 +03:00
};