A custom table model for displaying log entries.
More...
#include <log_table_model.h>
|
| | LogTableModel (QObject *parent=nullptr) |
| | Constructs a new LogTableModel object.
|
| int | rowCount (const QModelIndex &parent={}) const override |
| | Returns the number of rows in the model.
|
| int | columnCount (const QModelIndex &parent={}) const override |
| | Returns the number of columns in the model.
|
| QVariant | data (const QModelIndex &index, int role) const override |
| | Returns the data for a given role and index.
|
| QVariant | headerData (int section, Qt::Orientation orientation, int role) const override |
| | Returns the header data for a given section and orientation.
|
| 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.
|
|
void | clear () |
| | Clears all log entries from the model.
|
| QString | toString (logging::LogLevel level) const |
| | Converts a log level to a string representation.
|
| QIcon | toIcon (logging::LogLevel level) const |
| | Converts a log level to an icon.
|
A custom table model for displaying log entries.
◆ Column
| Enumerator |
|---|
| TimeColumn | The column index for the log level.
|
| MessageColumn | The column index for the timestamp.
|
| SourceColumn | The column index for the log message.
|
| FileColumn | The column index for the source of the log entry.
|
| LineColumn | The column index for the file where the log entry was generated.
|
| ColumnCount | The column index for the line number in the file.
The total number of columns.
|
◆ LogTableModel()
| LogTableModel::LogTableModel |
( |
QObject * | parent = nullptr | ) |
|
◆ append()
| void LogTableModel::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.
- Parameters
-
| level | The log level of the entry. |
| source | The source of the log entry. |
| file | The file where the log entry was generated. |
| line | The line number in the file. |
| message | The log message. |
◆ columnCount()
| int LogTableModel::columnCount |
( |
const QModelIndex & | parent = {} | ) |
const |
|
override |
Returns the number of columns in the model.
- Parameters
-
- Returns
- int The number of columns.
◆ data()
| QVariant LogTableModel::data |
( |
const QModelIndex & | index, |
|
|
int | role ) const |
|
override |
Returns the data for a given role and index.
- Parameters
-
| index | The index of the item to retrieve. |
| role | The role of the data to retrieve. |
- Returns
- QVariant The data for the specified role and index.
◆ headerData()
| QVariant LogTableModel::headerData |
( |
int | section, |
|
|
Qt::Orientation | orientation, |
|
|
int | role ) const |
|
override |
Returns the header data for a given section and orientation.
- Parameters
-
| section | The section of the header. |
| orientation | The orientation of the header (horizontal or vertical). |
| role | The role of the data to retrieve. |
- Returns
- QVariant The header data for the specified section, orientation, and role.
◆ rowCount()
| int LogTableModel::rowCount |
( |
const QModelIndex & | parent = {} | ) |
const |
|
override |
Returns the number of rows in the model.
- Parameters
-
- Returns
- int The number of rows.
◆ toIcon()
| QIcon LogTableModel::toIcon |
( |
logging::LogLevel | level | ) |
const |
Converts a log level to an icon.
- Parameters
-
| level | The log level to convert. |
- Returns
- QIcon The icon representing the log level.
◆ toString()
| QString LogTableModel::toString |
( |
logging::LogLevel | level | ) |
const |
Converts a log level to a string representation.
- Parameters
-
| level | The log level to convert. |
- Returns
- QString The string representation of the log level.
The documentation for this class was generated from the following files:
- /__w/maki/maki/app/widgets/log_table_model.h
- /__w/maki/maki/app/widgets/log_table_model.cpp