diff options
author | Steru <jerrydream111@gmail.com> | 2024-08-15 23:27:54 +0200 |
---|---|---|
committer | Steru <jerrydream111@gmail.com> | 2024-08-16 23:53:31 +0200 |
commit | b869b8983656b12f9dee59439acfb6b3db647b72 (patch) | |
tree | 9bbb90ed4bfd6c9937beb3f5871ce2a6fbaa7059 /src/model/CompetitorWithResults.h | |
parent | 4f12d941f949bb8b8c1d043ac34772c5c80f1b89 (diff) |
Made Competitor a QObject and tidied up some code.
Diffstat (limited to 'src/model/CompetitorWithResults.h')
-rw-r--r-- | src/model/CompetitorWithResults.h | 36 |
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; }; |