3#include <QAbstractListModel>
20 explicit ThreadList(QObject *parent =
nullptr);
25 const QModelIndex &parent = QModelIndex())
const override;
30 [[nodiscard]] QVariant
data(
const QModelIndex &index,
31 int role = Qt::DisplayRole)
const override;
34 [[nodiscard]] QHash<int, QByteArray>
roleNames()
const override;
38 [[nodiscard]]
inline const QList<Thread *> &
threads()
const {
56 QList<Thread *> m_Threads;
The ThreadList class provides a model for the chat threads.
Definition thread_list.h:10
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows under the given parent.
Definition thread_list.cpp:10
void deleteThread(const QModelIndex &model_index)
Removes the thread at the given index.
Definition thread_list.cpp:50
ThreadRoles
The data roles for the model.
Definition thread_list.h:16
@ CreatedAtRole
Definition thread_list.h:16
@ TextRole
Definition thread_list.h:16
QHash< int, QByteArray > roleNames() const override
Returns the role names for the model.
Definition thread_list.cpp:30
QList< Thread * > threads
Definition thread_list.h:12
ThreadList(QObject *parent=nullptr)
Constructs a new ThreadList object.
Definition thread_list.cpp:8
void deleteAllThreads()
Removes all the threads.
Definition thread_list.cpp:58
Thread * createNewThread()
Creates a new thread.
Definition thread_list.cpp:42
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Returns the data stored under the given role for the item referred to by the index.
Definition thread_list.cpp:15
Thread * getThread(const QModelIndex &model_index)
Returns the thread at the given index.
Definition thread_list.cpp:37
const QList< Thread * > & threads() const
Returns the list of threads.
Definition thread_list.h:38
The Thread class provides a model for the chat interface.
Definition thread.h:13
Definition backend.cpp:11