From 7dd84ff9b1f94041a8760033df5b3cb5912b533c Mon Sep 17 00:00:00 2001 From: talksik Date: Fri, 6 Feb 2026 15:06:25 -0800 Subject: [PATCH] fix: show particle after creation --- src/MainWindow.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 4ce2fea..e541ff4 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -527,7 +527,15 @@ void MainWindow::onTextMessageSubmitted(const QString &text) if (m_selectedStreamId.isEmpty()) return; - m_store->createParticle(m_selectedStreamId, "text", {{"content", text}}); + auto *op = m_store->createParticle(m_selectedStreamId, "text", {{"content", text}}); + connect(op, &Operation::success, this, [this](const QJsonDocument &) { + int lastRow = m_particleListModel->rowCount() - 1; + if (lastRow >= 0) + { + ui->particlesView->setCurrentIndex(m_particleListModel->index(lastRow, 0)); + ui->particlesView->setFocus(); + } + }); } void MainWindow::mousePressEvent(QMouseEvent *event)