notifications: right-click to fully dismiss in popup and center

This commit is contained in:
Damocles 2026-04-13 09:05:02 +02:00
parent a2472851ae
commit 531e913238
2 changed files with 12 additions and 7 deletions

View file

@ -257,6 +257,8 @@ M.PopupPanel {
anchors.fill: parent anchors.fill: parent
z: -1 z: -1
hoverEnabled: true hoverEnabled: true
acceptedButtons: Qt.RightButton
onClicked: _dismissAnim.start()
} }
} }
} }

View file

@ -210,6 +210,13 @@ PanelWindow {
} }
} }
property bool _fullDismiss: false
function animateDismiss(full) {
_fullDismiss = !!full;
slideOut.start();
}
ParallelAnimation { ParallelAnimation {
id: slideOut id: slideOut
NumberAnimation { NumberAnimation {
@ -233,18 +240,14 @@ PanelWindow {
duration: 200 duration: 200
easing.type: Easing.InCubic easing.type: Easing.InCubic
} }
onFinished: M.NotifService.dismissPopup(popupItem.modelData.id) onFinished: popupItem._fullDismiss ? M.NotifService.dismiss(popupItem.modelData.id) : M.NotifService.dismissPopup(popupItem.modelData.id)
} }
function animateDismiss() {
slideOut.start();
}
// Click to dismiss
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
z: -1 z: -1
onClicked: popupItem.animateDismiss() acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: mouse => popupItem.animateDismiss(mouse.button === Qt.RightButton)
} }
} }
} }