diff --git a/panels/notification/bubble/bubblemodel.cpp b/panels/notification/bubble/bubblemodel.cpp index 84cf93361..1bcc6ee82 100644 --- a/panels/notification/bubble/bubblemodel.cpp +++ b/panels/notification/bubble/bubblemodel.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -83,7 +83,7 @@ void BubbleModel::clear() m_bubbles.clear(); endResetModel(); m_delayBubbles.clear(); - m_delayRemovedBubble = -1; + m_delayRemovedBubble = NotifyEntity::InvalidId; updateLevel(); m_updateTimeTipTimer->stop(); diff --git a/panels/notification/bubble/bubblemodel.h b/panels/notification/bubble/bubblemodel.h index 1398f4925..5977775ff 100644 --- a/panels/notification/bubble/bubblemodel.h +++ b/panels/notification/bubble/bubblemodel.h @@ -1,10 +1,11 @@ -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later #pragma once #include "dsglobal.h" +#include "notifyentity.h" #include @@ -82,7 +83,7 @@ class BubbleModel : public QAbstractListModel int m_contentRowCount{6}; const int OverlayMaxCount{2}; QList m_delayBubbles; - qint64 m_delayRemovedBubble{-1}; + qint64 m_delayRemovedBubble{NotifyEntity::InvalidId}; const int DelayRemovBubbleTime{1000}; }; diff --git a/panels/notification/bubble/package/Bubble.qml b/panels/notification/bubble/package/Bubble.qml index 6db090156..4a78cbedc 100644 --- a/panels/notification/bubble/package/Bubble.qml +++ b/panels/notification/bubble/package/Bubble.qml @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: LGPL-3.0-or-later @@ -16,7 +16,7 @@ Control { if (control.hovered) { Applet.bubbles.delayRemovedBubble = bubble.id } else { - Applet.bubbles.delayRemovedBubble = -1 + Applet.bubbles.delayRemovedBubble = NotifyEntity.InvalidId } } diff --git a/panels/notification/common/memoryaccessor.cpp b/panels/notification/common/memoryaccessor.cpp index 8672b192f..a78668108 100644 --- a/panels/notification/common/memoryaccessor.cpp +++ b/panels/notification/common/memoryaccessor.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 @@ -34,8 +34,9 @@ qint64 MemoryAccessor::replaceEntity(qint64 id, const NotifyEntity &entity) const auto index = (iter - m_entities.begin()); Q_ASSERT(index >= 0); m_entities[index] = entity; + m_entities[index].setId(id); } else { - return -1; + return NotifyEntity::InvalidId; } return id;