mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-27 21:48:48 +03:00
35 lines
896 B
C++
35 lines
896 B
C++
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
|
// SPDX-FileCopyrightText: 2023 Nheko Contributors
|
|
//
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
class UsersModel final : public QAbstractListModel
|
|
{
|
|
public:
|
|
enum Roles
|
|
{
|
|
AvatarUrl = Qt::UserRole,
|
|
DisplayName,
|
|
UserID,
|
|
};
|
|
|
|
UsersModel(const std::string &roomId, QObject *parent = nullptr);
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override
|
|
{
|
|
(void)parent;
|
|
return (int)userids.size();
|
|
}
|
|
QVariant data(const QModelIndex &index, int role) const override;
|
|
|
|
private:
|
|
std::string room_id;
|
|
std::vector<QString> avatarUrls;
|
|
std::vector<QString> displayNames;
|
|
std::vector<QString> userids;
|
|
};
|