-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings-model.hpp
More file actions
35 lines (28 loc) · 1.09 KB
/
Copy pathsettings-model.hpp
File metadata and controls
35 lines (28 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once
#include <QAbstractItemModel>
#include "observer.hpp"
enum Columns {
Buttons = 0,
Active = 1,
Users = 2,
Expr = 3,
Action = 4,
COUNT = 5,
};
class ObserverSettingsModel : public QAbstractTableModel
{
//Q_OBJECT
public:
ObserverSettingsModel(observer_settings settings, QObject *parent = nullptr);
[[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
[[nodiscard]] int columnCount(const QModelIndex &parent = QModelIndex()) const override;
[[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
[[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
[[nodiscard]] Qt::ItemFlags flags(const QModelIndex &index) const override;
void addItem(const action_descriptor action);
void removeItem(const int index);
observer_settings *settings() { return &_settings; }
private:
observer_settings _settings;
};