summaryrefslogtreecommitdiff
path: root/src/model/CompetitorWithResults.h
diff options
context:
space:
mode:
authorSteru <jerrydream111@gmail.com>2024-08-15 23:27:54 +0200
committerOrangerot <purple@orangerot.dev>2024-08-26 11:19:38 +0200
commitb6c86f02ff7ecb74cc96af61d8216b232bcecb3e (patch)
tree26def991cecebcaf8704a5194ae84d4bfe137951 /src/model/CompetitorWithResults.h
parentdb2d0c21c48698d336ac6e60c42cc2533648b51d (diff)
Made Competitor a QObject and tidied up some code.
Diffstat (limited to 'src/model/CompetitorWithResults.h')
-rw-r--r--src/model/CompetitorWithResults.h36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/model/CompetitorWithResults.h b/src/model/CompetitorWithResults.h
index a58023f..2203064 100644
--- a/src/model/CompetitorWithResults.h
+++ b/src/model/CompetitorWithResults.h
@@ -5,27 +5,21 @@
#include <QString>
#include <QMap>
#include <QJsonObject>
-#include <QAbstractListModel>
+#include <QObject>
#include <stdexcept>
class CompetitorWithResults : public Competitor {
- Q_OBJECT
+ Q_OBJECT
- Q_PROPERTY(QString mark READ mark NOTIFY nMark)
- Q_PROPERTY(QString medalType READ medalType NOTIFY nMedalType)
- Q_PROPERTY(QString statistic READ statistic NOTIFY nStatistic)
+ Q_PROPERTY(QString mark READ mark NOTIFY nMark)
+ Q_PROPERTY(QString medalType READ medalType NOTIFY nMedalType)
+ Q_PROPERTY(QString statistic READ statistic NOTIFY nStatistic)
public:
- CompetitorWithResults() : Competitor() {
- this->mark = "";
- this->medalType = "";
- }
-
- CompetitorWithResults(const CompetitorWithResults &competitor) : Competitor(competitor) {
- this->mark = competitor.mark;
- this->medalType = competitor.medalType;
- }
+ CompetitorWithResults() : Competitor(), m_mark(""), m_medalType("") {}
+ CompetitorWithResults(const CompetitorWithResults &competitor) : Competitor(competitor),
+ m_mark(competitor.m_mark), m_medalType(competitor.m_medalType) {}
CompetitorWithResults(const QJsonObject &competitor) : Competitor(competitor) {
if (!competitor.contains("results")) throw invalid_argument("Competitor does not contain results.");
@@ -34,17 +28,17 @@ public:
}
bool setResults(const QJsonObject &results);
- void setStatistic(QString stat) { this->statistic = stat; }
+ void setStatistic(QString stat) { this->m_statistic = stat; }
- QString getMark() { return this->mark; }
- QString getMedalType() { return this->medalType; }
- QString getStatistic() { return this->statistic; }
+ QString getMark() { return this->m_mark; }
+ QString getMedalType() { return this->m_medalType; }
+ QString getStatistic() { return this->m_statistic; }
static bool compare(CompetitorWithResults lComp, CompetitorWithResults rComp);
private:
- QString mark;
- QString medalType;
- QString statistic;
+ QString m_mark;
+ QString m_medalType;
+ QString m_statistic;
};