diff options
Diffstat (limited to 'src/model/Competitor.h')
-rw-r--r-- | src/model/Competitor.h | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/src/model/Competitor.h b/src/model/Competitor.h index 51fc3b1..79552a5 100644 --- a/src/model/Competitor.h +++ b/src/model/Competitor.h @@ -4,11 +4,12 @@ #include <QString> #include <QMap> #include <QJsonObject> -#include <QAbstractListModel> +#include <QObject> + using namespace std; -class Competitor { +class Competitor : public QObject { Q_OBJECT @@ -17,42 +18,35 @@ class Competitor { Q_PROPERTY(QString noc READ noc NOTIFY nNoc) public: - Competitor() { - this->code = 0; - this->name = ""; - this->noc = ""; - } + Competitor() : m_code(0), m_name(""), m_noc("") {} + Competitor(const Competitor &competitor) : m_code(competitor.m_code), m_name(competitor.m_name), m_noc(competitor.m_noc) {} + Competitor(const QJsonObject &competitor) { setCompetitor(competitor); } - Competitor(const Competitor &competitor) { - this->code = competitor.code; - this->name = competitor.name; - this->noc = competitor.noc; - } + int getCode() { return this->m_code; } + QString getName() { return this->m_name; } + QString getNOC() { return this->m_noc; } - Competitor(const QJsonObject &competitor) { - setCompetitor(competitor); - } - - int getCode() { return this->code; } - QString getName() { return this->name; } - QString getNOC() { return this->noc; } - - void setCode(int code) { this->code = code; } - void setName(QString name) { this->name = name; } - void setNOC(QString noc) { this->noc = noc; } + void setCode(int code) { this->m_code = code; } + void setName(QString name) { this->m_name = name; } + void setNOC(QString noc) { this->m_noc = noc; } bool setCompetitor(const QJsonObject &competitor); static bool compareName(const Competitor &left, const Competitor &right) { - return left.name.compare(right.name) < 0; + return left.m_name.compare(right.m_name) < 0; } static bool compareNOC(const Competitor &left, const Competitor &right) { - return left.noc.compare(right.noc) < 0; + return left.m_noc.compare(right.m_noc) < 0; } +signals: + void nCode(); + void nName(); + void nNoc(); + private: - int code; - QString name; - QString noc; + int m_code; + QString m_name; + QString m_noc; }; |