notif actions

This commit is contained in:
end-4
2025-04-19 22:37:14 +02:00
parent 3677873a05
commit 17289cef29
@@ -19,8 +19,7 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
clip: true clip: true
// implicitHeight: notificationRowLayout.implicitHeight implicitHeight: ready ? notificationColumnLayout.implicitHeight + notificationListSpacing : 0
implicitHeight: ready ? notificationRowLayout.implicitHeight + notificationListSpacing : 0
Behavior on implicitHeight { Behavior on implicitHeight {
enabled: enableAnimation enabled: enableAnimation
NumberAnimation { NumberAnimation {
@@ -75,14 +74,17 @@ Item {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
implicitHeight: notificationRowLayout.implicitHeight + notificationListSpacing implicitHeight: notificationColumnLayout.implicitHeight + notificationListSpacing
ColumnLayout {
id: notificationColumnLayout
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
RowLayout { RowLayout {
id: notificationRowLayout id: notificationRowLayout
anchors.left: parent.left Layout.fillWidth: true
anchors.right: parent.right
// anchors.top: parent.top
anchors.bottom: parent.bottom
Rectangle { // App icon Rectangle { // App icon
id: iconRectangle id: iconRectangle
implicitWidth: 47 implicitWidth: 47
@@ -207,18 +209,25 @@ Item {
// textFormat: Text.MarkdownText // textFormat: Text.MarkdownText
text: notificationObject.body text: notificationObject.body
} }
}
}
// Actions
Flickable { Flickable {
id: actionsFlickable
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -5 Layout.topMargin: -5
Layout.leftMargin: 10 Layout.leftMargin: 10
Layout.rightMargin: 10 Layout.rightMargin: 10
Layout.bottomMargin: 10 Layout.bottomMargin: 10
visible: expanded
implicitHeight: actionRowLayout.implicitHeight implicitHeight: actionRowLayout.implicitHeight
contentWidth: actionRowLayout.implicitWidth contentWidth: actionRowLayout.implicitWidth
clip: true
RowLayout { // Actions visible: expanded
RowLayout {
id: actionRowLayout id: actionRowLayout
Repeater { Repeater {
@@ -238,6 +247,8 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
buttonText: "Close" buttonText: "Close"
urgency: notificationObject.urgency urgency: notificationObject.urgency
implicitWidth: (notificationObject.actions.length == 0) ? (actionsFlickable.width) :
(contentItem.implicitWidth + leftPadding + rightPadding)
onClicked: { onClicked: {
Notifications.discardNotification(notificationObject.id); Notifications.discardNotification(notificationObject.id);
} }
@@ -247,5 +258,4 @@ Item {
} }
} }
} }
}
} }