Skip to content

Commit cf97062

Browse files
committed
fix: Modifying notifications number, old notifications are displayed after new notifications are added.
as title Log: as title Bug: https://pms.uniontech.com/bug-view-290209.html
1 parent 735c434 commit cf97062

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

panels/notification/bubble/bubblemodel.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,23 @@ int BubbleModel::overlayCount() const
229229

230230
void BubbleModel::setBubbleCount(int count)
231231
{
232+
if (count == BubbleMaxCount)
233+
return;
234+
235+
int currentRowCount = rowCount(QModelIndex());
236+
237+
if (count < currentRowCount) {
238+
beginRemoveRows(QModelIndex(), count, currentRowCount - 1);
239+
endRemoveRows();
240+
} else if (count > currentRowCount) {
241+
int maxInsertCount = std::min(count, (int)m_bubbles.size());
242+
beginInsertRows(QModelIndex(), currentRowCount, maxInsertCount - 1);
243+
endInsertRows();
244+
}
245+
232246
BubbleMaxCount = count;
247+
248+
updateLevel();
233249
}
234250

235251
qint64 BubbleModel::delayRemovedBubble() const

0 commit comments

Comments
 (0)