This commit is contained in:
fourtf 2018-01-11 21:03:40 +01:00
parent a7fa4160e8
commit a339c4ca0a

View file

@ -378,10 +378,12 @@ void ChannelView::setChannel(SharedChannel newChannel)
auto messageRef = new MessageLayout(message);
if (this->messages.pushBack(MessageLayoutPtr(messageRef), deleted)) {
if (this->scrollBar.isAtBottom()) {
this->scrollBar.scrollToBottom();
} else {
this->scrollBar.offset(-1);
if (!this->paused) {
if (this->scrollBar.isAtBottom()) {
this->scrollBar.scrollToBottom();
} else {
this->scrollBar.offset(-1);
}
}
}
@ -404,11 +406,13 @@ void ChannelView::setChannel(SharedChannel newChannel)
messageRefs.at(i) = MessageLayoutPtr(new MessageLayout(messages.at(i)));
}
if (this->messages.pushFront(messageRefs).size() > 0) {
if (this->scrollBar.isAtBottom()) {
this->scrollBar.scrollToBottom();
} else {
this->scrollBar.offset((qreal)messages.size());
if (!this->paused) {
if (this->messages.pushFront(messageRefs).size() > 0) {
if (this->scrollBar.isAtBottom()) {
this->scrollBar.scrollToBottom();
} else {
this->scrollBar.offset((qreal)messages.size());
}
}
}