-
Notifications
You must be signed in to change notification settings - Fork 1
/
memorymodel.h
52 lines (45 loc) · 1.75 KB
/
memorymodel.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
/*!
* \file memorymodel.h
* \author Simon Coakley
* \date 2012
* \copyright Copyright (c) 2012 University of Sheffield
* \brief Header file for the memory table
*/
#ifndef MEMORYMODEL_H_
#define MEMORYMODEL_H_
#include <QtGui>
#include <QAbstractTableModel>
#include <QStringList>
#include "./variable.h"
class MemoryModel : public QAbstractTableModel {
Q_OBJECT
public:
explicit MemoryModel(QObject *parent = 0)
: QAbstractTableModel(parent) { myIsModel = false; }
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<Variable> getVariables() { return variables; }
QStringList getNames();
void replaceValue(int index, double value);
void replaceValue(QString type, QString value);
void addVariable(QString type, QString name,
QString desc, bool constant = false, double i = 0.0);
void setIsModel(bool b) { myIsModel = b; }
bool isModel() { return myIsModel; }
QList<Variable> variables;
private:
bool myIsModel; /*!< Flag to show if the memory is for model descriptors */
};
#endif // MEMORYMODEL_H_