LoggingModel

Qualified name: mv::LoggingModel

class LoggingModel : public mv::StandardItemModel

Logging model.

Model item class for log items

Author

Thomas Kroes

Public Types

enum class Column

Columns.

Values:

enumerator Number
enumerator Type
enumerator Message
enumerator FileAndLine
enumerator Function
enumerator Category
enumerator Count

Public Functions

LoggingModel(QObject *parent = nullptr)

Construct from parent.

Parameters:

parent – Pointer to parent object

LoggingModel(const LoggingModel&) = delete

No need for copy constructor.

~LoggingModel() override = default

No need for destructor.

LoggingModel &operator=(const LoggingModel&) = delete

No need for assignment operator.

QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override

Get header data for section, orientation and display role.

Parameters:
  • section – Section

  • orientation – Orientation

  • role – Data role

Returns:

Header

class CategoryItem : public mv::LoggingModel::Item

Standard model item class for displaying the message category.

Public Functions

QVariant data(int role = Qt::UserRole + 1) const override

Get model data for role.

Returns:

Data for role in variant form

Item(LoggingModel &loggingModel, const util::MessageRecord &messageRecord)

No need to override base constructor.

Public Static Functions

static inline QVariant headerData(Qt::Orientation orientation, int role)

Get header data for orientation and role.

Parameters:
  • orientation – Horizontal/vertical

  • role – Data role

Returns:

Header data

class FileAndLineItem : public mv::LoggingModel::Item

Standard model item class for displaying the message file and line.

Public Functions

QVariant data(int role = Qt::UserRole + 1) const override

Get model data for role.

Returns:

Data for role in variant form

Item(LoggingModel &loggingModel, const util::MessageRecord &messageRecord)

No need to override base constructor.

Public Static Functions

static inline QVariant headerData(Qt::Orientation orientation, int role)

Get header data for orientation and role.

Parameters:
  • orientation – Horizontal/vertical

  • role – Data role

Returns:

Header data

class FunctionItem : public mv::LoggingModel::Item

Standard model item class for displaying the message function.

Public Functions

QVariant data(int role = Qt::UserRole + 1) const override

Get model data for role.

Returns:

Data for role in variant form

Item(LoggingModel &loggingModel, const util::MessageRecord &messageRecord)

No need to override base constructor.

Public Static Functions

static inline QVariant headerData(Qt::Orientation orientation, int role)

Get header data for orientation and role.

Parameters:
  • orientation – Horizontal/vertical

  • role – Data role

Returns:

Header data

class Item : public QStandardItem, public QObject

Base standard model item class for message record.

Subclassed by mv::LoggingModel::CategoryItem, mv::LoggingModel::FileAndLineItem, mv::LoggingModel::FunctionItem, mv::LoggingModel::MessageItem, mv::LoggingModel::NumberItem, mv::LoggingModel::TypeItem

Public Functions

Item(LoggingModel &loggingModel, const util::MessageRecord &messageRecord)

Construct with messageRecord.

Parameters:
  • loggingModel – Reference to owning logging model

  • messageRecord – Reference to message record

QVariant data(int role = Qt::UserRole + 1) const override

Get model data for role.

Returns:

Data for role in variant form

LoggingModel &getLoggingModel()

Get logging model.

Returns:

Reference to owning logging model

const LoggingModel &getLoggingModel() const

Get logging model.

Returns:

Reference to owning logging model

const util::MessageRecord &getMessageRecord() const

Get message record.

Returns:

Reference to message record to display item for

class MessageItem : public mv::LoggingModel::Item

Standard model item class for displaying the message type.

Public Functions

MessageItem(LoggingModel &loggingModel, const util::MessageRecord &messageRecord)

Construct with messageRecord.

Parameters:
  • loggingModel – Reference to owning logging model

  • messageRecord – Reference to message record

QVariant data(int role = Qt::UserRole + 1) const override

Get model data for role.

Returns:

Data for role in variant form

Public Static Functions

static inline QVariant headerData(Qt::Orientation orientation, int role)

Get header data for orientation and role.

Parameters:
  • orientation – Horizontal/vertical

  • role – Data role

Returns:

Header data

class NumberItem : public mv::LoggingModel::Item

Standard model item class for interacting with the message number.

Public Functions

QVariant data(int role = Qt::UserRole + 1) const override

Get model data for role.

Returns:

Data for role in variant form

Item(LoggingModel &loggingModel, const util::MessageRecord &messageRecord)

No need to override base constructor.

Public Static Functions

static inline QVariant headerData(Qt::Orientation orientation, int role)

Get header data for orientation and role.

Parameters:
  • orientation – Horizontal/vertical

  • role – Data role

Returns:

Header data

class Row : public QList<QStandardItem*>

Convenience class for combining message record items in a row.

Public Functions

inline Row(LoggingModel &loggingModel, const util::MessageRecord &messageRecord)

Construct with reference to owning loggingModel and messageRecord.

Parameters:
  • loggingModel – Reference to owning logging model

  • MessageRecord – Reference to message record

class TypeItem : public mv::LoggingModel::Item

Standard model item class for displaying the message type.

Public Functions

QVariant data(int role = Qt::UserRole + 1) const override

Get model data for role.

Returns:

Data for role in variant form

Item(LoggingModel &loggingModel, const util::MessageRecord &messageRecord)

No need to override base constructor.

Public Static Functions

static inline QVariant headerData(Qt::Orientation orientation, int role)

Get header data for orientation and role.

Parameters:
  • orientation – Horizontal/vertical

  • role – Data role

Returns:

Header data