Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
ScriptListModel.h
Go to the documentation of this file.
1#pragma once
2#include <QAbstractListModel>
4
5namespace sf
6{
7
11class _MISC_CLASS ScriptListModel : public QAbstractListModel
12{
13 public:
17 explicit ScriptListModel(QObject* parent = nullptr);
18
22 enum EMode
23 {
25 mVariables
26 };
27
31 void setInterpreter(ScriptInterpreter* interpreter, EMode mode);
32
36 void refresh();
37
41 [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
42
46 [[nodiscard]] int rowCount(const QModelIndex& parent) const override;
47
51 [[nodiscard]] QVariant data(const QModelIndex& index, int role) const override;
52
56 [[nodiscard]] int columnCount(const QModelIndex& parent) const override;
57
61 [[nodiscard]] Qt::ItemFlags flags(const QModelIndex& index) const override;
62
66 bool setData(const QModelIndex& index, const QVariant& value, int role) override;
67
68 private:
72 ScriptInterpreter* _interpreter{nullptr};
76 EMode _mode{mInstructions};
77};
78
79}// namespace sf
Script interpreter for running a loaded script.
Definition ScriptInterpreter.h:14
Provides a model list for instructions and variables of a script.
Definition ScriptListModel.h:12
Qt::ItemFlags flags(const QModelIndex &index) const override
Overridden from base class to provide flags on an item by index.
bool setData(const QModelIndex &index, const QVariant &value, int role) override
Overridden from base class to provide assignment of an item when edited.
EMode
Modes available for this model.
Definition ScriptListModel.h:23
@ mInstructions
Definition ScriptListModel.h:24
ScriptListModel(QObject *parent=nullptr)
Constructor.
void refresh()
Called to refresh the attached viewer.
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Overridden from base class to provide column display names.
void setInterpreter(ScriptInterpreter *interpreter, EMode mode)
Set the interpreter and mode for the model.
QVariant data(const QModelIndex &index, int role) const override
Overridden from base class to provide the data to present.
int columnCount(const QModelIndex &parent) const override
Overridden from base class to provide the amount of columns.
int rowCount(const QModelIndex &parent) const override
Overridden from base class to provide the amount of rows.
#define _MISC_CLASS
Definition misc/global.h:40
Definition Application.h:10