diff options
author | Steru <jerrydream111@gmail.com> | 2024-08-15 19:21:02 +0200 |
---|---|---|
committer | Orangerot <purple@orangerot.dev> | 2024-08-26 11:19:38 +0200 |
commit | 87e9d4aa8b64e4a8262115f678febb241f2ac3d0 (patch) | |
tree | 7fa90b2e94d96f048b4ddc691ad28608c6eae176 /src/model/CompetitorWithResults.h | |
parent | 2aea4f96f5c2daf6ca0d237ca2288c6a767cdeeb (diff) |
Added Q Object macros.
Diffstat (limited to 'src/model/CompetitorWithResults.h')
-rw-r--r-- | src/model/CompetitorWithResults.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/model/CompetitorWithResults.h b/src/model/CompetitorWithResults.h index cb952f2..a313db2 100644 --- a/src/model/CompetitorWithResults.h +++ b/src/model/CompetitorWithResults.h @@ -6,11 +6,27 @@ #include <QString> #include <QMap> #include <QJsonObject> +#include <QAbstractListModel> #include <stdexcept> class CompetitorWithResults : public Competitor { + Q_OBJECT + + Q_PROPERTY(QString mark READ mark) + Q_PROPERTY(QString medalType READ medalType) + public: + CompetitorWithResults() : Competitor() { + this->mark = "-"; + this->medalType = "-"; + } + + CompetitorWithResults(const CompetitorWithResults &competitor) : Competitor(competitor) { + this->mark = competitor.mark; + this->medalType = competitor.medalType; + } + CompetitorWithResults(const QJsonObject &competitor) : Competitor(competitor) { if (!competitor.contains("results")) throw invalid_argument("Competitor does not contain results."); QJsonObject results = competitor["results"].toObject(); @@ -19,8 +35,14 @@ public: bool setResults(const QJsonObject &results); + QString getMark() { return this->mark; } + QString getMedalType() { return this->medalType; } + + static bool compare(CompetitorWithResults lComp, CompetitorWithResults rComp); + private: - QMap<QString, QString> results; + QString mark; + QString medalType; }; |