Log Viewer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.1 KiB

#ifndef LOGTREEMODEL
#define LOGTREEMODEL
#include "viewmodel/tree/TreeItem.h"
#include <QAbstractItemModel>
#include <type/Log.h>
class TreeModel : public QAbstractItemModel
{
Q_OBJECT
public:
Q_DISABLE_COPY_MOVE(TreeModel)
explicit TreeModel(QObject* parent = nullptr);
~TreeModel() override;
QVariant data(const QModelIndex& index, int role) const override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const override;
QModelIndex index(int row, int column,
const QModelIndex& parent = {}) const override;
QModelIndex parent(const QModelIndex& index) const override;
int rowCount(const QModelIndex& parent = {}) const override;
int columnCount(const QModelIndex& parent = {}) const override;
//uncrustify off
public slots:
void showSelectedLog(const Log_ptr log);
void clearView();
//uncrustify on
private:
bool _valid = false;
std::unique_ptr<TreeItem> _rootItem;
};
#endif //LOGTREEMODEL