summaryrefslogtreecommitdiff
path: root/src/model/CompetitorWithResults.h
diff options
context:
space:
mode:
authorSteru <jerrydream111@gmail.com>2024-08-15 19:21:02 +0200
committerSteru <jerrydream111@gmail.com>2024-08-16 23:50:34 +0200
commit70d5f014e50b9255dcb5c36122a109cc049c8936 (patch)
treef14ab291bec1a27457166ab1c4e0e70920b2ffa9 /src/model/CompetitorWithResults.h
parent173ce00cf29822294137d3ebacc5b33ad01a3d25 (diff)
Added Q Object macros.
Diffstat (limited to 'src/model/CompetitorWithResults.h')
-rw-r--r--src/model/CompetitorWithResults.h24
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;
};