From d840c5dca2090c90d7b7d5633d80f85d9f8758db Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Wed, 10 Mar 2021 12:35:15 +0100 Subject: [PATCH] [Notifications] Emit dataChanged in setData call Ensures the role is properly signalled to have changed. CCBUG: 429862 --- libnotificationmanager/abstractnotificationsmodel.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libnotificationmanager/abstractnotificationsmodel.cpp b/libnotificationmanager/abstractnotificationsmodel.cpp index 785a96767..d00a46bd2 100644 --- a/libnotificationmanager/abstractnotificationsmodel.cpp +++ b/libnotificationmanager/abstractnotificationsmodel.cpp @@ -365,17 +365,22 @@ bool AbstractNotificationsModel::setData(const QModelIndex &index, const QVarian } Notification ¬ification = d->notifications[index.row()]; + bool dirty = false; switch (role) { case Notifications::ReadRole: if (value.toBool() != notification.read()) { notification.setRead(value.toBool()); - return true; + dirty = true; } break; } - return false; + if (dirty) { + Q_EMIT dataChanged(index, index, {role}); + } + + return dirty; } int AbstractNotificationsModel::rowCount(const QModelIndex &parent) const