3#include <QAbstractTableModel>
57 int rowCount(
const QModelIndex& parent = {})
const override;
65 int columnCount(
const QModelIndex& parent = {})
const override;
74 QVariant
data(
const QModelIndex& index,
int role)
const override;
84 QVariant
headerData(
int section, Qt::Orientation orientation,
int role)
const override;
95 void append(logging::LogLevel level,
const QString& source,
const QString& file,
const uint32_t line,
const QString& message);
108 QString
toString(logging::LogLevel level)
const;
116 QIcon
toIcon(logging::LogLevel level)
const;
119 QVector<LogEntry> mEntries;
QIcon toIcon(logging::LogLevel level) const
Converts a log level to an icon.
Definition log_table_model.cpp:149
QVariant data(const QModelIndex &index, int role) const override
Returns the data for a given role and index.
Definition log_table_model.cpp:28
int columnCount(const QModelIndex &parent={}) const override
Returns the number of columns in the model.
Definition log_table_model.cpp:20
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Returns the header data for a given section and orientation.
Definition log_table_model.cpp:85
Column
Definition log_table_model.h:24
@ TimeColumn
The column index for the log level.
Definition log_table_model.h:26
@ LineColumn
The column index for the file where the log entry was generated.
Definition log_table_model.h:30
@ MessageColumn
The column index for the timestamp.
Definition log_table_model.h:27
@ ColumnCount
The column index for the line number in the file.
Definition log_table_model.h:31
@ SourceColumn
The column index for the log message.
Definition log_table_model.h:28
@ FileColumn
The column index for the source of the log entry.
Definition log_table_model.h:29
void append(logging::LogLevel level, const QString &source, const QString &file, const uint32_t line, const QString &message)
Appends a new log entry to the model.
Definition log_table_model.cpp:109
void clear()
Clears all log entries from the model.
Definition log_table_model.cpp:123
QString toString(logging::LogLevel level) const
Converts a log level to a string representation.
Definition log_table_model.cpp:130
LogTableModel(QObject *parent=nullptr)
Constructs a new LogTableModel object.
Definition log_table_model.cpp:7
int rowCount(const QModelIndex &parent={}) const override
Returns the number of rows in the model.
Definition log_table_model.cpp:12
Definition log_table_model.h:35
QString file
The log level of the entry.
Definition log_table_model.h:38
QString message
The source of the log entry.
Definition log_table_model.h:41
logging::LogLevel level
The timestamp of the log entry.
Definition log_table_model.h:37
QString source
The line number in the file.
Definition log_table_model.h:40
uint32_t line
The file where the log entry was generated.
Definition log_table_model.h:39