sidebar/notifs: fix interactions outside container

This commit is contained in:
2 * r + 2 * t 2025-09-20 16:21:42 +10:00
parent 42f8acedca
commit 5f1ffb32f4
4 changed files with 22 additions and 0 deletions

View file

@ -106,6 +106,7 @@ Item {
id: notifList id: notifList
props: root.props props: root.props
container: view
} }
} }
} }

View file

@ -10,6 +10,7 @@ Item {
id: root id: root
required property Props props required property Props props
required property Flickable container
readonly property alias repeater: repeater readonly property alias repeater: repeater
readonly property int spacing: Appearance.spacing.small readonly property int spacing: Appearance.spacing.small
@ -59,6 +60,14 @@ Item {
return y; return y;
} }
containmentMask: QtObject {
function contains(p: point): bool {
if (!root.container.contains(notif.mapToItem(root.container, p)))
return false;
return notifInner.contains(p);
}
}
implicitWidth: root.width implicitWidth: root.width
implicitHeight: notifInner.implicitHeight implicitHeight: notifInner.implicitHeight
@ -130,6 +139,7 @@ Item {
modelData: notif.modelData modelData: notif.modelData
props: root.props props: root.props
container: root.container
} }
Behavior on x { Behavior on x {

View file

@ -15,6 +15,7 @@ StyledRect {
required property string modelData required property string modelData
required property Props props required property Props props
required property Flickable container
readonly property list<var> notifs: Notifs.list.filter(n => n.appName === modelData) readonly property list<var> notifs: Notifs.list.filter(n => n.appName === modelData)
readonly property int notifCount: notifs.reduce((acc, n) => n.closed ? acc : acc + 1, 0) readonly property int notifCount: notifs.reduce((acc, n) => n.closed ? acc : acc + 1, 0)
@ -231,6 +232,7 @@ StyledRect {
props: root.props props: root.props
notifs: root.notifs notifs: root.notifs
expanded: root.expanded expanded: root.expanded
container: root.container
onRequestToggleExpand: expand => root.toggleExpand(expand) onRequestToggleExpand: expand => root.toggleExpand(expand)
} }
} }

View file

@ -13,6 +13,7 @@ Item {
required property Props props required property Props props
required property list<var> notifs required property list<var> notifs
required property bool expanded required property bool expanded
required property Flickable container
readonly property real nonAnimHeight: { readonly property real nonAnimHeight: {
let h = -root.spacing; let h = -root.spacing;
@ -60,6 +61,14 @@ Item {
return y; return y;
} }
containmentMask: QtObject {
function contains(p: point): bool {
if (!root.container.contains(notif.mapToItem(root.container, p)))
return false;
return notifInner.contains(p);
}
}
implicitWidth: root.width implicitWidth: root.width
implicitHeight: notifInner.implicitHeight implicitHeight: notifInner.implicitHeight