fixed notifications popup menu reserving too much space for the next card

This commit is contained in:
SomeElse
2026-04-27 08:41:02 +00:00
parent d817449e6b
commit 0fce9672f1
3 changed files with 46 additions and 33 deletions

View File

@@ -208,18 +208,19 @@ Rectangle {
Repeater { Repeater {
model: activeToasts model: activeToasts
Notif.NotificationCard { Notif.NotificationCard {
width: toastCol.width width: toastCol.width
toastId: model.toastId toastId: model.toastId
appName: model.appName appName: model.appName
summary: model.summary summary: model.summary
body: model.body body: model.body
urgency: model.urgency urgency: model.urgency
timeStr: model.timeStr timeStr: model.timeStr
timeout: model.timeout timeout: model.timeout
t: root.t t: root.t
urgencyColor: root.urgencyColor urgencyColor: root.urgencyColor
urgencyIcon: root.urgencyIcon urgencyIcon: root.urgencyIcon
onDismissed: (id) => root.removeToast(id) slideFromRight: toastLayer.atRight
onDismissed: (id) => root.removeToast(id)
} }
} }
} }

View File

@@ -154,7 +154,7 @@ QtObject {
// ── History popup ────────────────────────────────────────────────────────── // ── History popup ──────────────────────────────────────────────────────────
readonly property color notifHistoryBg: bgPopup readonly property color notifHistoryBg: bgPopup
readonly property color notifHistoryBorder: "#44c19375" readonly property color notifHistoryBorder: borderPopup
readonly property color notifHistoryShadow: "#aa000000" readonly property color notifHistoryShadow: "#aa000000"
readonly property color notifHistoryHover: "#11c19375" readonly property color notifHistoryHover: "#11c19375"
readonly property color notifHistoryEmpty: textDim readonly property color notifHistoryEmpty: textDim

View File

@@ -25,12 +25,41 @@ Item {
height: toastCard.height height: toastCard.height
property real progressVal: 1.0 property real progressVal: 1.0
property bool slideFromRight: false
property real slideX: slideFromRight ? (width + 20) : -(width + 20)
transform: Translate { id: slideTranslate; x: root.slideX }
Component.onCompleted: entranceSlide.start()
NumberAnimation {
id: entranceSlide
target: slideTranslate; property: "x"
from: root.slideX; to: 0
duration: 300; easing.type: Easing.OutCubic
}
function triggerDismiss() {
if (exitSlide.running) return
autoTimer.stop()
exitSlide.start()
}
NumberAnimation {
id: exitSlide
target: slideTranslate; property: "x"
to: root.slideX
duration: 220; easing.type: Easing.InCubic
onStopped: root.dismissed(root.toastId)
}
Timer { Timer {
id: autoTimer
interval: root.timeout interval: root.timeout
running: root.timeout > 0 running: root.timeout > 0
repeat: false repeat: false
onTriggered: root.dismissed(root.toastId) onTriggered: root.triggerDismiss()
} }
NumberAnimation on progressVal { NumberAnimation on progressVal {
@@ -39,23 +68,6 @@ Item {
running: root.urgency === NotificationUrgency.Low && root.timeout > 0 running: root.urgency === NotificationUrgency.Low && root.timeout > 0
} }
opacity: 0
scale: 0.90
Component.onCompleted: {
entranceOp.start()
entranceSc.start()
}
NumberAnimation {
id: entranceOp; target: root
property: "opacity"; from: 0; to: 1
duration: 240; easing.type: Easing.OutCubic
}
NumberAnimation {
id: entranceSc; target: root
property: "scale"; from: 0.90; to: 1.0
duration: 240; easing.type: Easing.OutBack
}
Rectangle { Rectangle {
id: toastCard id: toastCard
width: parent.width width: parent.width
@@ -73,7 +85,7 @@ Item {
Behavior on border.color { ColorAnimation { duration: 150 } } Behavior on border.color { ColorAnimation { duration: 150 } }
HoverHandler { id: cardHover } HoverHandler { id: cardHover }
TapHandler { onTapped: root.dismissed(root.toastId) } TapHandler { onTapped: root.triggerDismiss() }
Rectangle { Rectangle {
width: 4 width: 4
@@ -139,7 +151,7 @@ Item {
font.pixelSize: 10 font.pixelSize: 10
} }
HoverHandler { id: closeHover; cursorShape: Qt.PointingHandCursor } HoverHandler { id: closeHover; cursorShape: Qt.PointingHandCursor }
TapHandler { onTapped: root.dismissed(root.toastId) } TapHandler { onTapped: root.triggerDismiss() }
} }
} }