From 9ee403a3ee56b43f84c22108547d83f512f4a8d3 Mon Sep 17 00:00:00 2001 From: zhaoyingzhen Date: Sat, 30 Nov 2024 16:54:03 +0800 Subject: [PATCH] fix: Setting notifications number less than 3, do not display overlay as title Log: as title Bug: https://pms.uniontech.com/bug-view-290185.html --- panels/notification/bubble/bubblemodel.cpp | 3 ++- panels/notification/bubble/bubblemodel.h | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/panels/notification/bubble/bubblemodel.cpp b/panels/notification/bubble/bubblemodel.cpp index a79f50cec..26d7bb1f7 100644 --- a/panels/notification/bubble/bubblemodel.cpp +++ b/panels/notification/bubble/bubblemodel.cpp @@ -292,9 +292,10 @@ void BubbleModel::updateLevel() if (m_bubbles.isEmpty()) return; + int lastBubbleMaxIndex = BubbleMaxCount - 1; for (int i = 0; i < displayRowCount(); i++) { auto item = m_bubbles.at(i); - item->setLevel(i == LastBubbleMaxIndex ? 1 + overlayCount() : 1); + item->setLevel(i == lastBubbleMaxIndex ? 1 + overlayCount() : 1); } Q_EMIT dataChanged(index(0), index(displayRowCount() - 1), {BubbleModel::Level}); } diff --git a/panels/notification/bubble/bubblemodel.h b/panels/notification/bubble/bubblemodel.h index 12ebb391f..7645d6375 100644 --- a/panels/notification/bubble/bubblemodel.h +++ b/panels/notification/bubble/bubblemodel.h @@ -75,7 +75,6 @@ class BubbleModel : public QAbstractListModel QTimer *m_updateTimeTipTimer = nullptr; QList m_bubbles; int BubbleMaxCount{3}; - const int LastBubbleMaxIndex{BubbleMaxCount - 1}; const int OverlayMaxCount{2}; const int NoReplaceId{0}; QList m_delayBubbles;