There were added countNotificationsChanged signal and connect with HistoryNotificationsModel

This commit is contained in:
Alex 2023-04-15 16:13:27 +03:00
parent a5d21cb350
commit 50bc65df29
2 changed files with 6 additions and 0 deletions

View File

@ -14,6 +14,10 @@ NotificationService::NotificationService(QObject * ptr): QObject (ptr) {
qRegisterMetaType<QList<NotificationData>> ("QList<NotificationData>");
_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() {

View File

@ -158,6 +158,8 @@ public:
void sigShowHistory();
void countNotificationsChanged();
private:
explicit NotificationService(QObject *ptr = nullptr);