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
This commit is contained in:
thunder2 2012-02-23 23:30:53 +00:00
parent bd7fe9f53d
commit 9ab7920a7a

View File

@ -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;