improve vertical scrollbar popupchatdialog

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1490 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2009-08-04 14:38:31 +00:00
parent e57db77455
commit 59692a9aa9

View File

@ -228,6 +228,11 @@ void PopupChatDialog::updateChat()
void PopupChatDialog::addChatMsg(ChatInfo *ci)
{
//store the state of the vertical scrollbar to set it at the end of the function
QScrollBar *qsb = ui.textBrowser->verticalScrollBar();
int oldQsbValue = qsb->value();
bool maxQsbValue = (qsb->maximum() == qsb->value());
bool offline = true;
{
@ -300,9 +305,12 @@ std::cout << "PopupChatDialog:addChatMsg message : " << message.toStdString() <<
ui.textBrowser->setHtml(ui.textBrowser->toHtml() + formatMsg + "\n");
QTextCursor cursor = ui.textBrowser->textCursor();
cursor.movePosition(QTextCursor::End);
ui.textBrowser->setTextCursor(cursor);
if (maxQsbValue ) {
qsb -> setValue(qsb->maximum());
} else {
qsb -> setValue(oldQsbValue);
}
if(ci->chatflags & RS_CHAT_AVATAR_AVAILABLE)
{