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.
This commit is contained in:
parent
c6da563109
commit
59e1992f37
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Reference in New Issue