From 4e8e679581ad804444eef36bc93382ab2ef31159 Mon Sep 17 00:00:00 2001 From: re2zero Date: Wed, 4 Mar 2026 14:35:44 +0800 Subject: [PATCH] fix(notification): fix invisible delegates after collapsing expanded notifications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove emit layoutChanged() which breaks animations and add refresh mechanism to trigger ListView re-render of displaced delegates. 删除emit layoutChanged()避免破坏动画,通过模拟微小滚动触发ListView 重新渲染被移位的delegate。 PMS: BUG-351731 BUG-351729 Log: 修复收起超一屏应用通知时下方应用不显示的问题 Influence: 修复后收起应用通知下方应用正常显示,无需手动刷新 --- panels/notification/center/NotifyView.qml | 13 ++++++++++++- panels/notification/center/NotifyViewDelegate.qml | 4 +++- panels/notification/center/notifymodel.cpp | 4 +--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/panels/notification/center/NotifyView.qml b/panels/notification/center/NotifyView.qml index 12f13a8e0..818967744 100644 --- a/panels/notification/center/NotifyView.qml +++ b/panels/notification/center/NotifyView.qml @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -81,6 +81,17 @@ Control { expandFocusTimer.start() } + // Jiggles scroll ±1px to force ListView to re-render displaced delegates + function jiggleUpdate() { + if (contentY > 0) { + contentY--; + Qt.callLater(function() { contentY++; }); + } else { + contentY++; + Qt.callLater(function() { contentY--; }); + } + } + Timer { id: expandFocusTimer property int retries: 15 diff --git a/panels/notification/center/NotifyViewDelegate.qml b/panels/notification/center/NotifyViewDelegate.qml index 212252a08..f2ed3a970 100644 --- a/panels/notification/center/NotifyViewDelegate.qml +++ b/panels/notification/center/NotifyViewDelegate.qml @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -69,6 +69,7 @@ DelegateChooser { console.log("collapse group", model.appName) let collapseIndex = index notifyModel.collapseApp(index) + root.view.jiggleUpdate() root.view.requestFocusOnExpand(collapseIndex) } @@ -211,6 +212,7 @@ DelegateChooser { console.log("expand") let expandIndex = model.index notifyModel.expandApp(expandIndex) + root.view.jiggleUpdate() root.view.requestFocusOnExpand(expandIndex + 1) } onSetting: function (pos) { diff --git a/panels/notification/center/notifymodel.cpp b/panels/notification/center/notifymodel.cpp index e5d01b13a..0a5be295e 100644 --- a/panels/notification/center/notifymodel.cpp +++ b/panels/notification/center/notifymodel.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -129,8 +129,6 @@ void NotifyModel::collapseApp(int row) m_appNotifies.insert(row, overlap); endInsertRows(); } - - emit layoutChanged(); } void NotifyModel::close()