diff --git a/modules/sidebar/Notif.qml b/modules/sidebar/Notif.qml index 88bd0305..d646c4f0 100644 --- a/modules/sidebar/Notif.qml +++ b/modules/sidebar/Notif.qml @@ -88,7 +88,7 @@ StyledRect { anchors.leftMargin: Appearance.spacing.small sourceComponent: StyledText { - text: (root.modelData?.body ?? "").replace(/\n/g, " ") + text: String(root.modelData?.body ?? "").replace(/\n/g, " ") color: root.modelData?.urgency === "critical" ? Colours.palette.m3secondary : Colours.palette.m3outline elide: Text.ElideRight } @@ -138,7 +138,7 @@ StyledRect { Layout.fillWidth: true textFormat: Text.MarkdownText - text: (root.modelData?.body ?? "").replace(/(.)\n(?!\n)/g, "$1\n\n") || qsTr("No body here! :/") + text: String(root.modelData?.body ?? "").replace(/(.)\n(?!\n)/g, "$1\n\n") || qsTr("No body here! :/") color: root.modelData?.urgency === "critical" ? Colours.palette.m3secondary : Colours.palette.m3outline wrapMode: Text.WordWrap diff --git a/modules/sidebar/NotifDock.qml b/modules/sidebar/NotifDock.qml index dd88ec3d..11ce4dac 100644 --- a/modules/sidebar/NotifDock.qml +++ b/modules/sidebar/NotifDock.qml @@ -1,3 +1,5 @@ +pragma ComponentBehavior: Bound + import QtQuick import QtQuick.Layouts import Quickshell.Widgets diff --git a/modules/sidebar/NotifDockList.qml b/modules/sidebar/NotifDockList.qml index 98ad0d4d..a799cf1a 100644 --- a/modules/sidebar/NotifDockList.qml +++ b/modules/sidebar/NotifDockList.qml @@ -1,3 +1,5 @@ +pragma ComponentBehavior: Bound + import QtQuick import Quickshell import Caelestia.Components diff --git a/modules/sidebar/NotifGroupList.qml b/modules/sidebar/NotifGroupList.qml index fce03a50..a54a13b6 100644 --- a/modules/sidebar/NotifGroupList.qml +++ b/modules/sidebar/NotifGroupList.qml @@ -1,3 +1,5 @@ +pragma ComponentBehavior: Bound + import QtQuick import QtQuick.Layouts import Quickshell diff --git a/plugin/src/Caelestia/Components/lazylistview.cpp b/plugin/src/Caelestia/Components/lazylistview.cpp index d76ae3a7..d05ca095 100644 --- a/plugin/src/Caelestia/Components/lazylistview.cpp +++ b/plugin/src/Caelestia/Components/lazylistview.cpp @@ -637,8 +637,9 @@ LazyListView::DelegateEntry LazyListView::createDelegate(int modelIndex) { const auto roleNames = m_model->roleNames(); const auto role = roleNames.isEmpty() ? Qt::DisplayRole : roleNames.constBegin().key(); - // Use the delegate component's creation context so the delegate - // can access ids and properties from the scope where it was defined. + // Use the delegate component's creation context directly for beginCreate + // so bound components (pragma ComponentBehavior: Bound) are accepted. + // A per-delegate child context is kept for data updates. auto* compContext = m_delegate->creationContext(); auto* parentContext = compContext ? compContext : qmlContext(this); if (!parentContext) @@ -669,10 +670,15 @@ LazyListView::DelegateEntry LazyListView::createDelegate(int modelIndex) { initialProps.insert(QStringLiteral("modelData"), value); } - auto* obj = m_delegate->beginCreate(entry.context); + // Use the creation context for beginCreate to satisfy bound component checks + // (pragma ComponentBehavior: Bound). Data is passed via setInitialProperties. + auto* creationCtx = compContext ? compContext : parentContext; + auto* obj = m_delegate->beginCreate(creationCtx); entry.item = qobject_cast(obj); if (!entry.item) { + if (obj) + m_delegate->completeCreate(); delete obj; delete entry.context; entry.context = nullptr;