tweak the peer chat and group chat vertical scroll

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1848 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2009-11-27 22:05:38 +00:00
parent 046ec8c6a7
commit 97d8640f3a
2 changed files with 18 additions and 2 deletions

View file

@ -842,7 +842,15 @@ void PeersDialog::insertChat()
extraTxt.replace(code, "<img src=\"" + i.value() + "\" />");
}
msgWidget->append(extraTxt);
if ((msgWidget->verticalScrollBar()->maximum() - 30) < msgWidget->verticalScrollBar()->value() ) {
msgWidget->append(extraTxt);
} else {
//the vertical scroll is not at the bottom, so just update the text, the scroll will stay at the current position
int scroll = msgWidget->verticalScrollBar()->value();
msgWidget->setHtml(msgWidget->toHtml() + extraTxt);
msgWidget->verticalScrollBar()->setValue(scroll);
msgWidget->update();
}
}
}