forked from FLAME-HPC/flame_visualiser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
visualsettingsmodel.h
56 lines (47 loc) · 1.8 KB
/
visualsettingsmodel.h
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*!
* \file visualsettingsmodel.h
* \author Simon Coakley
* \date 2012
* \copyright Copyright (c) 2012 University of Sheffield
* \brief Header file for visual settings model
*/
#ifndef VISUALSETTINGSMODEL_H_
#define VISUALSETTINGSMODEL_H_
#include <QAbstractTableModel>
#include <QColor>
#include "./visualsettingsitem.h"
#include "./shape.h"
class VisualSettingsModel : public QAbstractTableModel {
Q_OBJECT
public:
explicit VisualSettingsModel(QObject *parent = 0)
: QAbstractTableModel(parent) {}
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
/* Functions to provide editing */
Qt::ItemFlags flags(const QModelIndex &index) const;
bool setData(const QModelIndex &index, const QVariant &value,
int role = Qt::EditRole);
/* Adding and removing rows */
bool insertRows(int position, int rows,
const QModelIndex &index = QModelIndex());
bool removeRows(int position, int rows,
const QModelIndex &index = QModelIndex());
QList<VisualSettingsItem *> getRules() const { return rules; }
VisualSettingsItem * getRule(int row) const { return rules[row]; }
void switchEnabled(QModelIndex index);
signals:
void ruleUpdated(int);
public slots:
void addRule();
void addRule(QString agentType, Condition condition, Position x,
Position y, Position z, Shape shape, QColor colour, bool enabled);
void deleteRule(QModelIndex index);
void deleteRules();
private:
QList<VisualSettingsItem *> rules;
};
#endif // VISUALSETTINGSMODEL_H_