-
Notifications
You must be signed in to change notification settings - Fork 0
/
TransitionList.hpp
53 lines (36 loc) · 1023 Bytes
/
TransitionList.hpp
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
#ifndef TRANSITIONLIST_HPP
#define TRANSITIONLIST_HPP
#include "Transition.hpp"
#include <QAbstractListModel>
#include <QList>
#include <QSignalMapper>
#include <memory>
class TransitionList:
public QAbstractListModel
{
Q_OBJECT
public:
TransitionList(QObject * parent = 0);
~TransitionList() override;
int rowCount(const QModelIndex & parent) const override;
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override;
QHash<int, QByteArray> roleNames() const override;
Q_INVOKABLE Transition * at(int index) const;
Q_INVOKABLE void append();
Q_INVOKABLE void remove(int index);
Q_INVOKABLE void removeAll();
protected slots:
void dataChangedFromTransition(QObject * transition);
private:
enum class Role : int {
NAME = Qt::UserRole,
TEMPERATURE_BEGIN,
TEMPERATURE_END,
ENTHALPY
};
private:
QList<Transition *> m_list;
QHash<int, QByteArray> m_roleNames;
QSignalMapper m_transitionSignalMapper;
};
#endif // TRANSITIONLISTMODEL_HPP