summaryrefslogtreecommitdiff
path: root/src/model/Sport.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/Sport.h')
-rw-r--r--src/model/Sport.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/model/Sport.h b/src/model/Sport.h
index 147f6e8..0f183b7 100644
--- a/src/model/Sport.h
+++ b/src/model/Sport.h
@@ -1,8 +1,8 @@
-
#ifndef ITAT_CHALLANGE_OLYMPICS_SPORT_H
#define ITAT_CHALLANGE_OLYMPICS_SPORT_H
-
+#include <QAbstractListModel>
+#include <QNetworkAccessManager>
#include <set>
#include <QJsonObject>
@@ -11,6 +11,28 @@
using namespace std;
+class SportModel : public QAbstractListModel {
+ Q_OBJECT
+
+ public:
+ enum Role {
+ SportName = Qt::UserRole + 1
+ };
+
+ explicit SportModel(QObject *parent = nullptr);
+
+ virtual int rowCount(const QModelIndex &parent) const override;
+ virtual QVariant data(const QModelIndex &index, int role) const override;
+ virtual QHash<int, QByteArray> roleNames() const override;
+ public slots:
+ void request();
+ void parseData();
+
+ private:
+ QList<QString> m_sportList;
+ QNetworkAccessManager m_networkManager;
+ QNetworkReply *m_reply = nullptr;
+};
class Sport {