diff options
Diffstat (limited to 'src/model/MedalWinner.h')
-rw-r--r-- | src/model/MedalWinner.h | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/model/MedalWinner.h b/src/model/MedalWinner.h index 7f17449..45d1ee8 100644 --- a/src/model/MedalWinner.h +++ b/src/model/MedalWinner.h @@ -9,25 +9,17 @@ #include <QAbstractListModel> class MedalWinner : public Competitor { - Q_OBJECT - Q_PROPERTY(int gold READ gold NOTIFY nGold) - Q_PROPERTY(int silver READ silver NOTIFY nSilver) - Q_PROPERTY(int bronze READ bronze NOTIFY nBronze) + Q_OBJECT -public: - MedalWinner() : Competitor() { - this->gold = 0; - this->silver = 0; - this->bronze = 0; - } - - MedalWinner(const MedalWinner &medalWinner) : Competitor(medalWinner) { - this->gold = medalWinner.gold; - this->silver = medalWinner.silver; - this->bronze = medalWinner.bronze; - } + Q_PROPERTY(int gold READ m_gold NOTIFY nGold) + Q_PROPERTY(int silver READ m_silver NOTIFY nSilver) + Q_PROPERTY(int bronze READ m_bronze NOTIFY nBronze) +public: + MedalWinner() : Competitor(), m_gold(0), m_silver(0), m_bronze(0) {} + MedalWinner(const MedalWinner &medalWinner) : Competitor(medalWinner), + m_gold(medalWinner.m_gold), m_silver(medalWinner.m_silver), m_bronze(medalWinner.m_bronze) {} MedalWinner(const QJsonObject &competitor) : Competitor(competitor) { if (!competitor.contains("medals")) throw invalid_argument("Competitor has no medals."); QJsonObject medals = competitor["medals"].toObject(); @@ -35,13 +27,13 @@ public: } bool setMedals(const QJsonObject &medals); - int getGold() { return gold; } - int getSilver() { return silver; } - int getBronze() { return bronze; } + int getGold() { return m_gold; } + int getSilver() { return m_silver; } + int getBronze() { return m_bronze; } static bool compare(MedalWinner lComp, MedalWinner rComp); private: - int gold, silver, bronze; + int m_gold, m_silver, m_bronze; }; |