notifications: fix spacing/eliding

This commit is contained in:
end-4
2025-06-07 14:10:31 +02:00
parent e03800cf64
commit 643b197d02
@@ -154,22 +154,32 @@ Item { // Notification group area
ColumnLayout { // Content ColumnLayout { // Content
Layout.fillWidth: true Layout.fillWidth: true
spacing: expanded ? spacing: expanded ? (root.multipleNotifications ?
((root.multipleNotifications && (notificationGroup?.notifications[root.notificationCount - 1].image != "") ? 35 :
notificationGroup?.notifications[root.notificationCount - 1].image != "") ? 35 : 5 : 0) : 0
5) : 0 // spacing: 00
Behavior on spacing { Behavior on spacing {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
} }
RowLayout { // App name (or summary when there's only 1 notif) and time Item { // App name (or summary when there's only 1 notif) and time
id: topRow id: topRow
spacing: 0 // spacing: 0
Layout.fillWidth: true
property real fontSize: Appearance.font.pixelSize.smaller property real fontSize: Appearance.font.pixelSize.smaller
property bool showAppName: root.multipleNotifications property bool showAppName: root.multipleNotifications
implicitHeight: Math.max(topTextRow.implicitHeight, expandButton.implicitHeight)
RowLayout {
id: topTextRow
anchors.left: parent.left
anchors.right: expandButton.left
anchors.verticalCenter: parent.verticalCenter
spacing: 5
StyledText { StyledText {
id: appName id: appName
elide: Text.ElideRight
Layout.fillWidth: true
text: (topRow.showAppName ? text: (topRow.showAppName ?
notificationGroup?.appName : notificationGroup?.appName :
notificationGroup?.notifications[0]?.summary) || "" notificationGroup?.notifications[0]?.summary) || ""
@@ -182,14 +192,18 @@ Item { // Notification group area
} }
StyledText { StyledText {
id: timeText id: timeText
text: " • " + NotificationUtils.getFriendlyNotifTimeString(notificationGroup?.time) // Layout.fillWidth: true
Layout.rightMargin: 10
horizontalAlignment: Text.AlignLeft
text: NotificationUtils.getFriendlyNotifTimeString(notificationGroup?.time)
font.pixelSize: topRow.fontSize font.pixelSize: topRow.fontSize
color: Appearance.colors.colSubtext color: Appearance.colors.colSubtext
Layout.alignment: Qt.AlignRight
Layout.fillWidth: true
} }
Item { Layout.fillWidth: true } }
NotificationGroupExpandButton { NotificationGroupExpandButton {
id: expandButton
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
count: root.notificationCount count: root.notificationCount
expanded: root.expanded expanded: root.expanded
fontSize: topRow.fontSize fontSize: topRow.fontSize