Skip to content

Commit

Permalink
fix: bubble doesn't hide
Browse files Browse the repository at this point in the history
Remove doesn't work when the bubble isn't shown,
NotifyItem isn't deleted.
NotifyHeader is hide by ListView's item.
Missing cursorShape when hovered link.

task: https://pms.uniontech.com/task-view-365219.html
  • Loading branch information
18202781743 authored and deepin-bot[bot] committed Oct 15, 2024
1 parent 322554b commit 21bd23c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 1 deletion.
8 changes: 7 additions & 1 deletion panels/notification/bubble/bubblemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,15 @@ QList<BubbleItem *> BubbleModel::items() const

void BubbleModel::remove(int index)
{
if (index < 0 || index >= displayRowCount())
if (index < 0 || index >= m_bubbles.size())
return;

if (index >= rowCount(QModelIndex())) {
auto bubble = m_bubbles.takeAt(index);
bubble->deleteLater();
return;
}

beginRemoveRows(QModelIndex(), index, index);
auto bubble = m_bubbles.takeAt(index);
bubble->deleteLater();
Expand Down
5 changes: 5 additions & 0 deletions panels/notification/bubble/package/BubbleContent.qml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ D.Control {
// The third line: body and image
RowLayout {
Text {
id: bodyText
visible: bubble.body !== ""
Layout.alignment: Qt.AlignLeft
Layout.rightMargin: 5
Expand All @@ -103,6 +104,10 @@ D.Control {
console.log("Link actived", link)
D.ApplicationHelper.openUrl(link)
}
HoverHandler {
enabled: bodyText.hoveredLink !== ""
cursorShape: Qt.PointingHandCursor
}
}

Item {
Expand Down
1 change: 1 addition & 0 deletions panels/notification/center/NotifyCenter.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ FocusScope {
height: 40
width: parent.width
notifyModel: notifyModel
z: 1
}

NotifyView {
Expand Down
5 changes: 5 additions & 0 deletions panels/notification/center/NotifyItemContent.qml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ NotifyItem {
Layout.fillWidth: true
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Text {
id: bodyText
Layout.alignment: Qt.AlignLeft
Layout.fillWidth: true
visible: text !== ""
Expand All @@ -195,6 +196,10 @@ NotifyItem {
onLinkActivated: function (link) {
root.linkActivated(link)
}
HoverHandler {
enabled: bodyText.hoveredLink !== ""
cursorShape: Qt.PointingHandCursor
}
}
Item {
Layout.preferredHeight: 1
Expand Down
1 change: 1 addition & 0 deletions panels/notification/center/NotifyView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Control {
contentItem: ListView {
id: view
spacing: 10
snapMode: ListView.SnapToItem
// activeFocusOnTab: true
ScrollBar.vertical: ScrollBar { }

Expand Down
2 changes: 2 additions & 0 deletions panels/notification/center/notifymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,13 @@ void NotifyModel::collapseApp(int row)
beginRemoveRows(QModelIndex(), start, start + notifies.size());
// remove group
m_appNotifies.removeOne(notify);
notify->deleteLater();

// remove normal
for (int i = 0; i < notifies.size(); i++) {
auto item = notifies[i];
m_appNotifies.removeOne(item);
item->deleteLater();
}
endRemoveRows();

Expand Down

0 comments on commit 21bd23c

Please sign in to comment.