From 87e9d4aa8b64e4a8262115f678febb241f2ac3d0 Mon Sep 17 00:00:00 2001 From: Steru Date: Thu, 15 Aug 2024 19:21:02 +0200 Subject: Added Q Object macros. --- src/model/CompetitorWithResults.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/model/CompetitorWithResults.h') 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 #include #include +#include #include 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 results; + QString mark; + QString medalType; }; -- cgit v1.2.3