From 4fdcac8ec53ba96b64c3483af933b5fb079a610e Mon Sep 17 00:00:00 2001 From: pajlada Date: Wed, 7 Dec 2022 20:40:15 +0100 Subject: [PATCH] Make LimitedQueueSnapshot usages in ChannelView const (#4223) --- src/widgets/helper/ChannelView.cpp | 9 ++++++--- src/widgets/helper/ChannelView.hpp | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index a7dddfac1..39211072f 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -426,7 +426,7 @@ void ChannelView::performLayout(bool causedByScrollbar) // BenchmarkGuard benchmark("layout"); /// Get messages and check if there are at least 1 - auto &messages = this->getMessagesSnapshot(); + const auto &messages = this->getMessagesSnapshot(); this->showingLatestMessages_ = this->scrollBar_->isAtBottom() || @@ -444,7 +444,7 @@ void ChannelView::performLayout(bool causedByScrollbar) } void ChannelView::layoutVisibleMessages( - LimitedQueueSnapshot &messages) + const LimitedQueueSnapshot &messages) { const auto start = size_t(this->scrollBar_->getCurrentValue()); const auto layoutWidth = this->getLayoutWidth(); @@ -468,11 +468,14 @@ void ChannelView::layoutVisibleMessages( } if (redrawRequired) + { this->queueUpdate(); + } } void ChannelView::updateScrollbar( - LimitedQueueSnapshot &messages, bool causedByScrollbar) + const LimitedQueueSnapshot &messages, + bool causedByScrollbar) { if (messages.size() == 0) { diff --git a/src/widgets/helper/ChannelView.hpp b/src/widgets/helper/ChannelView.hpp index b41b1d2f7..dc6141184 100644 --- a/src/widgets/helper/ChannelView.hpp +++ b/src/widgets/helper/ChannelView.hpp @@ -195,8 +195,8 @@ private: void performLayout(bool causedByScrollbar = false); void layoutVisibleMessages( - LimitedQueueSnapshot &messages); - void updateScrollbar(LimitedQueueSnapshot &messages, + const LimitedQueueSnapshot &messages); + void updateScrollbar(const LimitedQueueSnapshot &messages, bool causedByScrollbar); void drawMessages(QPainter &painter);