fix(Sport): disciplineChanged notification
This commit is contained in:
parent
3d19fd7271
commit
f87bc73c3f
|
@ -64,11 +64,12 @@ QString SportModel::discipline() const {
|
||||||
|
|
||||||
void SportModel::setDiscipline(const QString &discipline) {
|
void SportModel::setDiscipline(const QString &discipline) {
|
||||||
m_discipline = discipline;
|
m_discipline = discipline;
|
||||||
|
disciplineChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SportModel::request(QString discipline) {
|
void SportModel::request(QString discipline) {
|
||||||
m_discipline = discipline;
|
setDiscipline(discipline);
|
||||||
m_reply = m_networkManager.get(QNetworkRequest( k_requestUrl + m_discipline));
|
m_reply = m_networkManager.get(QNetworkRequest( k_requestUrl + m_discipline));
|
||||||
qDebug() << m_reply;
|
qDebug() << m_reply;
|
||||||
connect(m_reply, &QNetworkReply::finished, this, &SportModel::parseData);
|
connect(m_reply, &QNetworkReply::finished, this, &SportModel::parseData);
|
||||||
|
|
|
@ -16,7 +16,7 @@ using namespace std;
|
||||||
class SportModel : public QAbstractListModel {
|
class SportModel : public QAbstractListModel {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PROPERTY(QString discipline READ discipline WRITE setDiscipline);
|
Q_PROPERTY(QString discipline READ discipline WRITE setDiscipline NOTIFY disciplineChanged);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Role {
|
enum Role {
|
||||||
|
@ -37,6 +37,9 @@ class SportModel : public QAbstractListModel {
|
||||||
void request(QString discipline);
|
void request(QString discipline);
|
||||||
void parseData();
|
void parseData();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void disciplineChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<EventInfo*> m_sportList;
|
QList<EventInfo*> m_sportList;
|
||||||
QString m_discipline;
|
QString m_discipline;
|
||||||
|
|
Loading…
Reference in a new issue