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/NotifGroup.qml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'modules/sidebar/NotifGroup.qml') diff --git a/modules/sidebar/NotifGroup.qml b/modules/sidebar/NotifGroup.qml index 4476bf9..83cffcd 100644 --- a/modules/sidebar/NotifGroup.qml +++ b/modules/sidebar/NotifGroup.qml @@ -24,6 +24,15 @@ StyledRect { readonly property bool expanded: props.expandedNotifs.includes(modelData) + function toggleExpand(expand: bool): void { + if (expand) { + if (!expanded) + props.expandedNotifs.push(modelData); + } else if (expanded) { + props.expandedNotifs.splice(props.expandedNotifs.indexOf(modelData), 1); + } + } + anchors.left: parent?.left anchors.right: parent?.right implicitHeight: content.implicitHeight + Appearance.padding.normal * 2 @@ -156,10 +165,7 @@ StyledRect { color: root.urgency === "critical" ? Colours.palette.m3onError : Colours.palette.m3onSurface function onClicked(): void { - if (root.expanded) - root.props.expandedNotifs.splice(root.props.expandedNotifs.indexOf(root.modelData), 1); - else - root.props.expandedNotifs.push(root.modelData); + root.toggleExpand(!root.expanded); } } @@ -197,6 +203,7 @@ StyledRect { props: root.props notifs: root.notifs expanded: root.expanded + onRequestToggleExpand: expand => root.toggleExpand(expand) } } } -- cgit v1.2.3-freya