src/messagelog.h

changeset 236
1fa0e1de9f0a
child 264
76a025db4948
equal deleted inserted replaced
235:7ef03c2b46ab 236:1fa0e1de9f0a
1 #include <QAbstractTableModel>
2 #include "basics.h"
3
4 class MessageLog final : public QAbstractTableModel
5 {
6 Q_OBJECT
7 std::vector<Message> messages;
8 public:
9 enum Column {
10 TimeColumn,
11 MessageColumn,
12 };
13 static constexpr int NUM_COLUMNS = int(MessageColumn) + 1;
14 explicit MessageLog(QObject *parent = nullptr);
15 Q_SLOT void addMessage(const Message& message);
16
17 // QAbstractItemModel interface
18 public:
19 QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
20 int rowCount(const QModelIndex& parent) const override;
21 int columnCount(const QModelIndex& parent) const override;
22 QVariant data(const QModelIndex& index, int role) const override;
23 };

mercurial