Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
ScriptManagerListModel.h
Go to the documentation of this file.
1#pragma once
2#include <QAbstractItemView>
3#include <QAbstractListModel>
5
6namespace sf
7{
8
12class ScriptManagerListModel : public QAbstractListModel
13{
14 public:
18 explicit ScriptManagerListModel(ScriptManager* manager, QObject* parent = nullptr);
19
23 static void setDelegates(QAbstractItemView* view);
24
28 void refresh();
29
33 [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
34
38 [[nodiscard]] int rowCount(const QModelIndex& parent) const override;
39
43 [[nodiscard]] QVariant data(const QModelIndex& index, int role) const override;
44
48 [[nodiscard]] int columnCount(const QModelIndex& parent) const override;
49
53 [[nodiscard]] Qt::ItemFlags flags(const QModelIndex& index) const override;
54
58 bool setData(const QModelIndex& index, const QVariant& value, int role) override;
59
63 void add(const QModelIndex& index);
64
69 void remove(QModelIndex index);
70
74 void startAll() const;
75
79 void start(const QModelIndex& index) const;
80
84 void stop(const QModelIndex& index) const;
85
86 private:
90 ScriptManager* _manager{nullptr};
91};
92
93}// namespace sf
List model for manipulating the passed script manager.
Definition ScriptManagerListModel.h:13
QVariant data(const QModelIndex &index, int role) const override
Overridden from base class to provide the data to present.
Qt::ItemFlags flags(const QModelIndex &index) const override
Overridden from base class to provide flags on an item by index.
ScriptManagerListModel(ScriptManager *manager, QObject *parent=nullptr)
Constructor.
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.
static void setDelegates(QAbstractItemView *view)
Sets the item delegate on a new CommonItemDelegate instance.
bool setData(const QModelIndex &index, const QVariant &value, int role) override
Overridden from base class to provide assignment of an item when edited.
void startAll() const
Compiles and initializes all scripts.
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Overridden from base class to provide column display names.
void stop(const QModelIndex &index) const
Stops the script from running in the background at the passed index row.
void add(const QModelIndex &index)
Adds a new entry to the end or after specified index of the list.
void start(const QModelIndex &index) const
Compiles and initializes the script at the passed index row.
void remove(QModelIndex index)
Removes an entry at specified index.
void refresh()
Called to refresh the attached viewer.
Manages scripts for the application.
Definition ScriptManager.h:20
Definition Application.h:10