src/messagelog.h

Mon, 20 Jun 2022 19:49:56 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Mon, 20 Jun 2022 19:49:56 +0300
changeset 237
10a6298f636f
parent 236
1fa0e1de9f0a
child 264
76a025db4948
permissions
-rw-r--r--

Add an option to log opengl messages

#include <QAbstractTableModel>
#include "basics.h"

class MessageLog final : public QAbstractTableModel
{
	Q_OBJECT
	std::vector<Message> 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;
};

mercurial