diff -r 7ef03c2b46ab -r 1fa0e1de9f0a src/messagelog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/messagelog.h Mon Jun 20 18:40:22 2022 +0300 @@ -0,0 +1,23 @@ +#include +#include "basics.h" + +class MessageLog final : public QAbstractTableModel +{ + Q_OBJECT + std::vector messages; +public: + enum Column { + TimeColumn, + MessageColumn, + }; + static constexpr int NUM_COLUMNS = int(MessageColumn) + 1; + explicit MessageLog(QObject *parent = nullptr); + Q_SLOT void addMessage(const Message& message); + + // QAbstractItemModel interface +public: + QVariant headerData(int section, Qt::Orientation orientation, int role) const override; + int rowCount(const QModelIndex& parent) const override; + int columnCount(const QModelIndex& parent) const override; + QVariant data(const QModelIndex& index, int role) const override; +};