mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:09:52 +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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Application::processEvents();
|
||||||
|
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
}
|
}
|
||||||
|
@ -262,6 +263,8 @@ void ChatWindow::error(QXmppClient::Error error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWindow::participantsChanged() {
|
void ChatWindow::participantsChanged() {
|
||||||
|
bool atBottom = isNearBottom();
|
||||||
|
|
||||||
QStringList participants = XmppClient::getInstance().getPublicChatRoom()->participants();
|
QStringList participants = XmppClient::getInstance().getPublicChatRoom()->participants();
|
||||||
ui->numOnlineLabel->setText(tr("%1 online now:").arg(participants.count()));
|
ui->numOnlineLabel->setText(tr("%1 online now:").arg(participants.count()));
|
||||||
|
|
||||||
|
@ -288,6 +291,11 @@ void ChatWindow::participantsChanged() {
|
||||||
userLabel->installEventFilter(this);
|
userLabel->installEventFilter(this);
|
||||||
ui->usersWidget->layout()->addWidget(userLabel);
|
ui->usersWidget->layout()->addWidget(userLabel);
|
||||||
}
|
}
|
||||||
|
Application::processEvents();
|
||||||
|
|
||||||
|
if (atBottom) {
|
||||||
|
scrollToBottom();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWindow::messageReceived(const QXmppMessage& message) {
|
void ChatWindow::messageReceived(const QXmppMessage& message) {
|
||||||
|
|
Loading…
Reference in a new issue