diff --git a/notificationservice.cpp b/notificationservice.cpp index dd588a1..2fce1df 100644 --- a/notificationservice.cpp +++ b/notificationservice.cpp @@ -14,6 +14,10 @@ NotificationService::NotificationService(QObject * ptr): QObject (ptr) { qRegisterMetaType> ("QList"); _history = new HistoryNotificationsModel(); QQmlEngine::setObjectOwnership(_history, QQmlEngine::CppOwnership); + + connect(_history, &HistoryNotificationsModel::rowsInserted, this, &NotificationService::countNotificationsChanged); + connect(_history, &HistoryNotificationsModel::rowsRemoved, this, &NotificationService::countNotificationsChanged); + connect(_history, &HistoryNotificationsModel::modelReset, this, &NotificationService::countNotificationsChanged); } NotificationService::~NotificationService() { diff --git a/notificationservice.h b/notificationservice.h index 53de8a4..73bf389 100644 --- a/notificationservice.h +++ b/notificationservice.h @@ -158,6 +158,8 @@ public: void sigShowHistory(); + void countNotificationsChanged(); + private: explicit NotificationService(QObject *ptr = nullptr);