From 326a33059d1ac622a46f20837377c1b1f5ad9254 Mon Sep 17 00:00:00 2001 From: Phenom Date: Sat, 22 Aug 2015 17:38:35 +0200 Subject: [PATCH] Fix ChatWidget last cursor formatting. To test it, search a text that will be colored a end. New messages lose their format. --- retroshare-gui/src/gui/chat/ChatWidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index 5e8067577..3db7d990c 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -888,7 +888,9 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const QDateTime formatMsg.prepend(QString("").arg(timeStamp).arg(name)); //To call this anchor do: ui->textBrowser->scrollToAnchor(QString("%1_%2").arg(timeStamp).arg(name)); - ui->textBrowser->textCursor().setBlockFormat(QTextBlockFormat ()); + QTextCursor textCursor = QTextCursor(ui->textBrowser->textCursor()); + textCursor.movePosition(QTextCursor::End); + textCursor.setBlockFormat(QTextBlockFormat ()); ui->textBrowser->append(formatMsg); if (ui->leSearch->isVisible()) {