llm-chat 0.0.0
LLM-Chat
Loading...
Searching...
No Matches
llm_chat::ThreadList Class Reference

The ThreadList class provides a model for the chat threads. More...

#include <thread_list.h>

Inheritance diagram for llm_chat::ThreadList:
[legend]
Collaboration diagram for llm_chat::ThreadList:
[legend]

Public Types

enum  ThreadRoles { TextRole = Qt::UserRole + 1 , CreatedAtRole }
 The data roles for the model. More...
 

Public Member Functions

 ThreadList (QObject *parent=nullptr)
 Constructs a new ThreadList object.
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 Returns the number of rows under the given parent.
 
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.
 
QHash< int, QByteArray > roleNames () const override
 Returns the role names for the model.
 
const QList< Thread * > & threads () const
 Returns the list of threads.
 
ThreadgetThread (const QModelIndex &model_index)
 Returns the thread at the given index.
 
ThreadcreateNewThread ()
 Creates a new thread.
 
void deleteThread (const QModelIndex &model_index)
 Removes the thread at the given index.
 
void deleteAllThreads ()
 Removes all the threads.
 

Properties

QList< Thread * > threads
 

Detailed Description

The ThreadList class provides a model for the chat threads.

Member Enumeration Documentation

◆ ThreadRoles

The data roles for the model.

Enumerator
TextRole 
CreatedAtRole 

Constructor & Destructor Documentation

◆ ThreadList()

llm_chat::ThreadList::ThreadList ( QObject * parent = nullptr)
explicit

Constructs a new ThreadList object.

Parameters
parentThe parent object.

Member Function Documentation

◆ createNewThread()

Thread * llm_chat::ThreadList::createNewThread ( )

Creates a new thread.

This function creates a new thread and sets it as the active thread.

Here is the call graph for this function:

◆ data()

QVariant llm_chat::ThreadList::data ( const QModelIndex & index,
int role = Qt::DisplayRole ) const
nodiscardoverride

Returns the data stored under the given role for the item referred to by the index.

Parameters
indexThe model index.
roleThe data role.

◆ deleteAllThreads()

void llm_chat::ThreadList::deleteAllThreads ( )

Removes all the threads.

◆ deleteThread()

void llm_chat::ThreadList::deleteThread ( const QModelIndex & model_index)

Removes the thread at the given index.

Parameters
model_indexThe index of the thread to remove.

◆ getThread()

Thread * llm_chat::ThreadList::getThread ( const QModelIndex & model_index)
nodiscard

Returns the thread at the given index.

Parameters
model_indexThe index of the thread.
Returns
The thread at the given index.

◆ roleNames()

QHash< int, QByteArray > llm_chat::ThreadList::roleNames ( ) const
nodiscardoverride

Returns the role names for the model.

Returns
The role names for the model.

◆ rowCount()

int llm_chat::ThreadList::rowCount ( const QModelIndex & parent = QModelIndex()) const
nodiscardoverride

Returns the number of rows under the given parent.

Parameters
parentThe parent index.
Here is the caller graph for this function:

◆ threads()

const QList< Thread * > & llm_chat::ThreadList::threads ( ) const
inlinenodiscard

Returns the list of threads.

Returns
The list of threads.

Property Documentation

◆ threads

QList<Thread *> llm_chat::ThreadList::threads
read

The documentation for this class was generated from the following files: