mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 09:24:00 +02:00
Fix chat window scrolling to stay at bottom
Stay at bottom window when: - There is new chat. - People come and go from online list. - Chat window hides and restores when application focus changes. - Interface is minimized and restored.
This commit is contained in:
parent
97e5c928a4
commit
7c3d3976ee
1 changed files with 8 additions and 0 deletions
|
@ -248,6 +248,7 @@ void ChatWindow::notificationClicked() {
|
|||
return;
|
||||
}
|
||||
}
|
||||
Application::processEvents();
|
||||
|
||||
scrollToBottom();
|
||||
}
|
||||
|
@ -262,6 +263,8 @@ void ChatWindow::error(QXmppClient::Error error) {
|
|||
}
|
||||
|
||||
void ChatWindow::participantsChanged() {
|
||||
bool atBottom = isNearBottom();
|
||||
|
||||
QStringList participants = XmppClient::getInstance().getPublicChatRoom()->participants();
|
||||
ui->numOnlineLabel->setText(tr("%1 online now:").arg(participants.count()));
|
||||
|
||||
|
@ -288,6 +291,11 @@ void ChatWindow::participantsChanged() {
|
|||
userLabel->installEventFilter(this);
|
||||
ui->usersWidget->layout()->addWidget(userLabel);
|
||||
}
|
||||
Application::processEvents();
|
||||
|
||||
if (atBottom) {
|
||||
scrollToBottom();
|
||||
}
|
||||
}
|
||||
|
||||
void ChatWindow::messageReceived(const QXmppMessage& message) {
|
||||
|
|
Loading…
Reference in a new issue