mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-17 10:27:13 -05:00
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:
parent
e57db77455
commit
59692a9aa9
@ -228,6 +228,11 @@ void PopupChatDialog::updateChat()
|
|||||||
|
|
||||||
void PopupChatDialog::addChatMsg(ChatInfo *ci)
|
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;
|
bool offline = true;
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -300,9 +305,12 @@ std::cout << "PopupChatDialog:addChatMsg message : " << message.toStdString() <<
|
|||||||
|
|
||||||
ui.textBrowser->setHtml(ui.textBrowser->toHtml() + formatMsg + "\n");
|
ui.textBrowser->setHtml(ui.textBrowser->toHtml() + formatMsg + "\n");
|
||||||
|
|
||||||
QTextCursor cursor = ui.textBrowser->textCursor();
|
|
||||||
cursor.movePosition(QTextCursor::End);
|
if (maxQsbValue ) {
|
||||||
ui.textBrowser->setTextCursor(cursor);
|
qsb -> setValue(qsb->maximum());
|
||||||
|
} else {
|
||||||
|
qsb -> setValue(oldQsbValue);
|
||||||
|
}
|
||||||
|
|
||||||
if(ci->chatflags & RS_CHAT_AVATAR_AVAILABLE)
|
if(ci->chatflags & RS_CHAT_AVATAR_AVAILABLE)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user