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();
}
}
}

View File

@ -289,7 +289,15 @@ std::cout << "PopupChatDialog:addChatMsg message : " << message.toStdString() <<
.replace("%name%", name)
.replace("%message%", message);
ui.textBrowser->append(formatMsg + "\n");
if ((ui.textBrowser->verticalScrollBar()->maximum() - 30) < ui.textBrowser->verticalScrollBar()->value() ) {
ui.textBrowser->append(formatMsg + "\n");
} else {
//the vertical scroll is not at the bottom, so just update the text, the scroll will stay at the current position
int scroll = ui.textBrowser->verticalScrollBar()->value();
ui.textBrowser->setHtml(ui.textBrowser->toHtml() + formatMsg + "\n");
ui.textBrowser->verticalScrollBar()->setValue(scroll);
ui.textBrowser->update();
}
resetStatusBar() ;
}