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 {
model: activeToasts
Notif.NotificationCard {
width: toastCol.width
toastId: model.toastId
appName: model.appName
summary: model.summary
body: model.body
urgency: model.urgency
timeStr: model.timeStr
timeout: model.timeout
t: root.t
urgencyColor: root.urgencyColor
urgencyIcon: root.urgencyIcon
onDismissed: (id) => root.removeToast(id)
width: toastCol.width
toastId: model.toastId
appName: model.appName
summary: model.summary
body: model.body
urgency: model.urgency
timeStr: model.timeStr
timeout: model.timeout
t: root.t
urgencyColor: root.urgencyColor
urgencyIcon: root.urgencyIcon
slideFromRight: toastLayer.atRight
onDismissed: (id) => root.removeToast(id)
}
}
}

View File

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

View File

@@ -25,12 +25,41 @@ Item {
height: toastCard.height
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 {
id: autoTimer
interval: root.timeout
running: root.timeout > 0
repeat: false
onTriggered: root.dismissed(root.toastId)
onTriggered: root.triggerDismiss()
}
NumberAnimation on progressVal {
@@ -39,23 +68,6 @@ Item {
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 {
id: toastCard
width: parent.width
@@ -73,7 +85,7 @@ Item {
Behavior on border.color { ColorAnimation { duration: 150 } }
HoverHandler { id: cardHover }
TapHandler { onTapped: root.dismissed(root.toastId) }
TapHandler { onTapped: root.triggerDismiss() }
Rectangle {
width: 4
@@ -139,7 +151,7 @@ Item {
font.pixelSize: 10
}
HoverHandler { id: closeHover; cursorShape: Qt.PointingHandCursor }
TapHandler { onTapped: root.dismissed(root.toastId) }
TapHandler { onTapped: root.triggerDismiss() }
}
}