From b6c86f02ff7ecb74cc96af61d8216b232bcecb3e Mon Sep 17 00:00:00 2001 From: Steru Date: Thu, 15 Aug 2024 23:27:54 +0200 Subject: Made Competitor a QObject and tidied up some code. --- src/model/CompetitorWithResults.h | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'src/model/CompetitorWithResults.h') 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 #include #include -#include +#include #include 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; }; -- cgit v1.2.3