662cf79ab0ca79579f4d482d730119e91e32f518
[harbour-pedalo.git] / src / statsmodel.h
1 #ifndef STATSMODEL_H
2 #define STATSMODEL_H
3
4 #include <QAbstractListModel>
5 #include <QStringList>
6
7 #include "stats.h"
8
9 class StatsModel : public QAbstractListModel
10 {
11 Q_OBJECT
12 public:
13 enum StatsRoles {
14 TitleRole = Qt::UserRole + 1,
15 ValuesRole,
16 LabelsRole,
17 UnitsRole,
18 MinValRole,
19 MaxValRole,
20 StepRole
21 };
22
23 QHash<int, QByteArray> roleNames() const;
24
25 StatsModel(QObject *parent = 0);
26
27 void addStats(Stats &stats);
28
29 int rowCount(const QModelIndex & parent = QModelIndex()) const;
30
31 QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
32
33 void clear();
34
35 Q_INVOKABLE void updateAll();
36
37 private:
38 QHash<int, QByteArray> roles;
39 QList<Stats *> stats;
40 };
41
42 #endif // STATSMODEL_H