From 9ab7920a7a5c5f9283ef2090f5beb3889ec9c875 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Thu, 23 Feb 2012 23:30:53 +0000 Subject: [PATCH] Fixed scroll position of the text browser in the chat dialog when the friend changes the status and the info frame is shown or hidden. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4983 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/chat/ChatWidget.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index 0fed46d83..847e0345c 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -611,6 +611,10 @@ void ChatWidget::updateStatus(const QString &peer_id, int status) QString peerName = QString::fromUtf8(rsPeers->getPeerName(peerId).c_str()); + // is scrollbar at the end? + QScrollBar *scrollbar = ui->textBrowser->verticalScrollBar(); + bool atEnd = (scrollbar->value() == scrollbar->maximum()); + switch (status) { case RS_STATUS_OFFLINE: ui->infoframe->setVisible(true); @@ -642,6 +646,11 @@ void ChatWidget::updateStatus(const QString &peer_id, int status) peerStatus = status; + if (atEnd) { + // scroll to the end + scrollbar->setValue(scrollbar->maximum()); + } + emit infoChanged(this); return;