From 59e1992f37219eacf7ff605e88346672451a8593 Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Sun, 9 Aug 2026 11:57:49 +0200 Subject: [PATCH] gui: emit dataChanged on block close for segment updates When a complete block arrives in a single streaming chunk, the QML Repeater may not pick up intermediate segment updates because the event loop hasn't run. Emit an explicit dataChanged with SegmentsRole when [[[end]]] closes a block, ensuring the delegate shows the final rendered content. --- gui/chatblockmodel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gui/chatblockmodel.cpp b/gui/chatblockmodel.cpp index f5f974b..69a46da 100644 --- a/gui/chatblockmodel.cpp +++ b/gui/chatblockmodel.cpp @@ -759,6 +759,12 @@ void ChatBlockModel::processLine(const QString &line) case State::BlockEnd: // [[[end]]] closes the current block if (s_endRe.match(line).hasMatch()) { + // Emit final update so QML picks up the completed segment state. + if (!m_blocks.isEmpty()) { + int blockIndex = m_blocks.size() - 1; + QModelIndex idx = index(blockIndex); + emit dataChanged(idx, idx, {ContentRole, RenderedHtmlRole, SegmentsRole}); + } m_state = State::BlockStart; return; }