From 1e35caa6f7a3b8e3aaf77bfeb307d15c3ea7e32d Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Fri, 19 Sep 2025 00:08:56 +1000 Subject: sidebar/notifs: add mouse actions --- modules/sidebar/NotifGroupList.qml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'modules/sidebar/NotifGroupList.qml') diff --git a/modules/sidebar/NotifGroupList.qml b/modules/sidebar/NotifGroupList.qml index 7def80f..675dc44 100644 --- a/modules/sidebar/NotifGroupList.qml +++ b/modules/sidebar/NotifGroupList.qml @@ -17,6 +17,8 @@ Item { readonly property int spacing: Math.round(Appearance.spacing.small / 2) property bool flag + signal requestToggleExpand(expand: bool) + Layout.fillWidth: true implicitHeight: { const item = repeater.itemAt(repeater.count - 1); @@ -56,16 +58,26 @@ Item { hoverEnabled: true cursorShape: pressed ? Qt.ClosedHandCursor : undefined - acceptedButtons: Qt.LeftButton | Qt.MiddleButton + acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton + preventStealing: true drag.target: this drag.axis: Drag.XAxis onPressed: event => { startY = event.y; - if (event.button === Qt.MiddleButton) + if (event.button === Qt.RightButton) + root.requestToggleExpand(!root.expanded); + else if (event.button === Qt.MiddleButton) modelData.close(); } + onPositionChanged: event => { + if (pressed) { + const diffY = event.y - startY; + if (Math.abs(diffY) > Config.notifs.expandThreshold) + root.requestToggleExpand(diffY > 0); + } + } onReleased: event => { if (Math.abs(x) < width * Config.notifs.clearThreshold) x = 0; -- cgit v1.2.3-freya