Repository navigation
Expand file tree
/
Copy pathgraphsettingsmodel.h
More file actions
63 lines (54 loc) · 2.1 KB
/
Copy pathgraphsettingsmodel.h
File metadata and controls
63 lines (54 loc) · 2.1 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*!
* \file graphsettingsmodel.h
* \author Simon Coakley
* \date 2012
* \copyright Copyright (c) 2012 University of Sheffield
* \brief Header file for graph settings model
*/
#ifndef GRAPHSETTINGSMODEL_H_
#define GRAPHSETTINGSMODEL_H_
#include <QAbstractTableModel>
#include <QColor>
#include "./graphsettingsitem.h"
#include "./agent.h"
#include "./condition.h"
class GraphSettingsModel : public QAbstractTableModel {
Q_OBJECT
public:
GraphSettingsModel(QList<Agent*> *a = 0, QObject *parent = 0)
: QAbstractTableModel(parent) { agents = a; }
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<GraphSettingsItem *> getPlots() const { return plots; }
GraphSettingsItem * getPlot(int row) const { return plots[row]; }
QList<GraphSettingsItem *> getPlotsInSameGraph(QModelIndex index);
void switchEnabled(QModelIndex index);
void setDisabled(QString graphName);
signals:
void plotGraphChanged(GraphSettingsItem * gsi, QString oldGraph,
QString newGraph);
public slots:
void addPlot();
void addPlot(QString g, QString x, QString y, Condition cond,
QColor c, bool e);
void deletePlot(QModelIndex index);
void deletePlots();
// void graph_window_closed();
private:
QList<Agent*> *agents;
QList<GraphSettingsItem *> plots;
// QList<GraphWidget *> graphs;
};
#endif // GRAPHSETTINGSMODEL_H_