Skip to content
Snippets Groups Projects
RoomsModel.h 820 B
Newer Older
  • Learn to ignore specific revisions
  • // SPDX-FileCopyrightText: Nheko Contributors
    
    Nicolas Werner's avatar
    Nicolas Werner committed
    //
    // SPDX-License-Identifier: GPL-3.0-or-later
    
    
    #include "CacheStructs.h"
    
    
    #include <QAbstractListModel>
    #include <QString>
    
    
    class RoomsModel final : public QAbstractListModel
    
        enum Roles
        {
            AvatarUrl = Qt::UserRole,
            RoomAlias,
            RoomID,
            RoomName,
    
        RoomsModel(bool showOnlyRoomWithAliases = false, QObject *parent = nullptr);
        QHash<int, QByteArray> roleNames() const override;
        int rowCount(const QModelIndex &parent = QModelIndex()) const override
        {
            (void)parent;
    
    Nicolas Werner's avatar
    Nicolas Werner committed
            return (int)rooms.size();
    
        }
        QVariant data(const QModelIndex &index, int role) const override;
    
    Nicolas Werner's avatar
    Nicolas Werner committed
        std::vector<RoomNameAlias> rooms;
    
        bool showOnlyRoomWithAliases_;