From c03520696629a107ba148073c3a136f44d946c57 Mon Sep 17 00:00:00 2001 From: Mengci Cai Date: Tue, 10 Mar 2026 09:59:04 +0800 Subject: [PATCH] fix: improve notification bubble panel hide animation Changed the bubble panel visibility logic to include a 400ms delay before hiding when there are no notifications. This prevents the panel from disappearing abruptly when the last bubble is removed. The QML ListView now includes a remove transition with smooth exit animation for bubbles. Added QTimer include for delayed hide functionality. Modified the ListView height calculation to use maximum of contentHeight and childrenRect.height to ensure proper layout during animations. Implemented a sequential animation for bubble removal with x-axis slide- out effect. Log: Improved notification bubble animations with smoother hide effects Influence: 1. Test notification bubble appearance and disappearance 2. Verify panel remains visible during bubble removal animations 3. Check that multiple bubbles animate correctly 4. Test edge cases with rapid notification additions/removals 5. Verify panel properly hides after all bubbles are removed 6. Test animation timing and smoothness PMS: BUG-284659 --- panels/notification/bubble/bubblepanel.cpp | 11 +++++++++-- panels/notification/bubble/package/main.qml | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/panels/notification/bubble/bubblepanel.cpp b/panels/notification/bubble/bubblepanel.cpp index f9ecc9439..f643b7833 100644 --- a/panels/notification/bubble/bubblepanel.cpp +++ b/panels/notification/bubble/bubblepanel.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 @@ -8,6 +8,7 @@ #include "dataaccessorproxy.h" #include "pluginfactory.h" +#include #include #include @@ -110,7 +111,13 @@ void BubblePanel::onNotificationStateChanged(qint64 id, int processedType) void BubblePanel::onBubbleCountChanged() { bool isEmpty = m_bubbles->items().isEmpty(); - setVisible(!isEmpty && enabled()); + if (isEmpty) { + QTimer::singleShot(400, this, [this]() { + setVisible(false); + }); + } else { + setVisible(!isEmpty && enabled()); + } } void BubblePanel::addBubble(qint64 id) diff --git a/panels/notification/bubble/package/main.qml b/panels/notification/bubble/package/main.qml index 80ccac395..342a14169 100644 --- a/panels/notification/bubble/package/main.qml +++ b/panels/notification/bubble/package/main.qml @@ -129,8 +129,29 @@ Window { } } delegate: Bubble { + id: delegateItem width: 360 bubble: model + + ListView.onRemove: SequentialAnimation { + PropertyAction { + target: delegateItem + property: "ListView.delayRemove" + value: true + } + NumberAnimation { + target: delegateItem + property: "x" + to: 360 + duration: 400 + easing.type: Easing.InExpo + } + PropertyAction { + target: delegateItem + property: "ListView.delayRemove" + value: false + } + } } } }