notifs: close on middle button
This commit is contained in:
parent
60254019c8
commit
78ce9835ca
1 changed files with 9 additions and 3 deletions
|
|
@ -30,14 +30,20 @@ StyledRect {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
preventStealing: true
|
preventStealing: true
|
||||||
|
cursorShape: pressed ? Qt.ClosedHandCursor : undefined
|
||||||
|
acceptedButtons: Qt.LeftButton | Qt.MiddleButton
|
||||||
|
|
||||||
onEntered: root.modelData.timer.stop()
|
onEntered: root.modelData?.timer.stop()
|
||||||
onExited: root.modelData.timer.start()
|
onExited: root.modelData?.timer.start()
|
||||||
|
|
||||||
drag.target: parent
|
drag.target: parent
|
||||||
drag.axis: Drag.XAxis
|
drag.axis: Drag.XAxis
|
||||||
|
|
||||||
onPressed: event => startY = event.y
|
onPressed: event => {
|
||||||
|
startY = event.y;
|
||||||
|
if (event.button === Qt.MiddleButton)
|
||||||
|
root.modelData.notification.dismiss();
|
||||||
|
}
|
||||||
onReleased: event => {
|
onReleased: event => {
|
||||||
if (Math.abs(root.x) < NotifsConfig.sizes.width * NotifsConfig.clearThreshold)
|
if (Math.abs(root.x) < NotifsConfig.sizes.width * NotifsConfig.clearThreshold)
|
||||||
root.x = 0;
|
root.x = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue