fixed freeze when messages get taller when they get higher

This commit is contained in:
fourtf 2018-05-06 16:12:21 +02:00
parent c2363e17e7
commit aba8e1a18f
2 changed files with 6 additions and 4 deletions

View file

@ -54,7 +54,7 @@ ChannelView::ChannelView(BaseWidget *parent)
this->scrollBar.getCurrentValueChanged().connect([this] {
// Whenever the scrollbar value has been changed, re-render the ChatWidgetView
this->layoutMessages();
this->actuallyLayoutMessages(true);
this->goToBottom->setVisible(this->enableScrollingToBottom && this->scrollBar.isVisible() &&
!this->scrollBar.isAtBottom());
@ -163,7 +163,7 @@ void ChannelView::layoutMessages()
// }
}
void ChannelView::actuallyLayoutMessages()
void ChannelView::actuallyLayoutMessages(bool causedByScrollbar)
{
auto app = getApp();
@ -233,8 +233,10 @@ void ChannelView::actuallyLayoutMessages()
this->scrollBar.setVisible(showScrollbar);
if (!showScrollbar) {
if (!causedByScrollbar) {
this->scrollBar.setDesiredValue(0);
}
}
this->scrollBar.setMaximum(messagesSnapshot.getLength());

View file

@ -94,7 +94,7 @@ private:
messages::LimitedQueueSnapshot<messages::MessageLayoutPtr> snapshot;
void detachChannel();
void actuallyLayoutMessages();
void actuallyLayoutMessages(bool causedByScollbar = false);
void drawMessages(QPainter &painter);
void setSelection(const messages::SelectionItem &start, const messages::SelectionItem &end);