feat: multi-height delegates

This commit is contained in:
Kat Inskip 2025-12-07 21:34:18 -08:00
parent b15bb36dae
commit 9ae22c832f
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
9 changed files with 284 additions and 212 deletions

View file

@ -0,0 +1,76 @@
import Quickshell
import Quickshell.Widgets
import Quickshell.Io
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import "root:/DataSources"
import "root:/Helpers"
import Quickshell.Services.Notifications
Item {
required property Notification modelData
function calculateHeight() {
if (modelData.actions.length > 0) {
return 150
} else if (modelData.image != "") {
return 100
} else {
return 60
}
}
function calculateBodyHeight() {
if (modelData.image != "" || modelData.actions.length > 0) {
return 40
} else {
return 20
}
}
height: calculateHeight()
width: 450
Rectangle {
id: indivNotif
color: Stylix.base02
radius: 5
anchors {
fill: parent
leftMargin: 5
rightMargin: 5
}
RowLayout {
anchors {
fill: parent
}
NotificationImage {
image: modelData.image
}
ColumnLayout {
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: 5
Layout.rightMargin: 5
Layout.fillWidth: true
NotificationHeader {
modelData_: modelData
}
Text {
font.pointSize: 10
wrapMode: Text.WordWrap
Layout.fillWidth: true
Layout.preferredWidth: modelData.image != "" ? indivNotif.width - 80 : indivNotif.width
Layout.maximumHeight: calculateBodyHeight()
Layout.maximumWidth: indivNotif.width
elide: Text.ElideRight
text: modelData.body
color: Stylix.base05
}
NotificationActions {
modelData_: modelData
}
}
}
}
}