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)