Support multiple graphs
[harbour-pedalo.git] / src / statsmodel.h
diff --git a/src/statsmodel.h b/src/statsmodel.h
new file mode 100644 (file)
index 0000000..2c9991a
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef STATSMODEL_H
+#define STATSMODEL_H
+
+#include <QAbstractListModel>
+#include <QStringList>
+
+#include "stats.h"
+
+class StatsModel : public QAbstractListModel
+{
+    Q_OBJECT
+public:
+    enum StatsRoles {
+        ValuesRole = Qt::UserRole + 1,
+        LabelsRole
+    };
+
+    QHash<int, QByteArray> roleNames() const;
+
+    StatsModel(QObject *parent = 0);
+
+    void addStats(const Stats &stats);
+
+    int rowCount(const QModelIndex & parent = QModelIndex()) const;
+
+    QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
+
+    void clear();
+
+private:
+    QHash<int, QByteArray> roles;
+    QList<Stats> stats;
+};
+
+#endif // STATSMODEL_H