Removed scroll to the end in ChatWidget (private chat and chat lobby) when the scrollbar is not at the end.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4835 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-01-23 19:57:06 +00:00
parent 5529588a1f
commit fadc86b189
2 changed files with 10 additions and 4 deletions

View File

@ -60,6 +60,7 @@ ChatWidget::ChatWidget(QWidget *parent) :
typing = false;
peerStatus = 0;
isChatLobby = false;
firstShow = true;
lastStatusSendTime = 0 ;
chatStyle.setStyleFromSettings(ChatStyle::TYPE_PRIVATE);
@ -253,6 +254,13 @@ void ChatWidget::showEvent(QShowEvent */*event*/)
newMessages = false;
emit infoChanged(this);
focusDialog();
if (firstShow) {
// Workaround: now the scroll position is correct calculated
firstShow = false;
QScrollBar *scrollbar = ui->textBrowser->verticalScrollBar();
scrollbar->setValue(scrollbar->maximum());
}
}
void ChatWidget::resizeEvent(QResizeEvent */*event*/)
@ -303,10 +311,6 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const QDateTime
ui->textBrowser->append(formatMsg);
/* Scroll to the end */
QScrollBar *scrollbar = ui->textBrowser->verticalScrollBar();
scrollbar->setValue(scrollbar->maximum());
resetStatusBar();
if (incoming && chatType == TYPE_NORMAL) {

View File

@ -139,6 +139,8 @@ private:
ChatStyle chatStyle;
RSStyle style;
bool firstShow;
Ui::ChatWidget *ui;
};