From f87bc73c3f7ff003444ce2b0fef2229f501bd1d4 Mon Sep 17 00:00:00 2001 From: Orangerot Date: Fri, 16 Aug 2024 16:17:16 +0200 Subject: fix(Sport): disciplineChanged notification --- src/model/Sport.cpp | 3 ++- src/model/Sport.h | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/model') diff --git a/src/model/Sport.cpp b/src/model/Sport.cpp index a21e21d..c7a9c72 100644 --- a/src/model/Sport.cpp +++ b/src/model/Sport.cpp @@ -64,11 +64,12 @@ QString SportModel::discipline() const { void SportModel::setDiscipline(const QString &discipline) { m_discipline = discipline; + disciplineChanged(); } void SportModel::request(QString discipline) { - m_discipline = discipline; + setDiscipline(discipline); m_reply = m_networkManager.get(QNetworkRequest( k_requestUrl + m_discipline)); qDebug() << m_reply; connect(m_reply, &QNetworkReply::finished, this, &SportModel::parseData); diff --git a/src/model/Sport.h b/src/model/Sport.h index 01798fb..6a68570 100644 --- a/src/model/Sport.h +++ b/src/model/Sport.h @@ -16,7 +16,7 @@ using namespace std; class SportModel : public QAbstractListModel { Q_OBJECT - Q_PROPERTY(QString discipline READ discipline WRITE setDiscipline); + Q_PROPERTY(QString discipline READ discipline WRITE setDiscipline NOTIFY disciplineChanged); public: enum Role { @@ -37,6 +37,9 @@ class SportModel : public QAbstractListModel { void request(QString discipline); void parseData(); + signals: + void disciplineChanged(); + private: QList m_sportList; QString m_discipline; -- cgit v1.2.3