From edcea52cc66926274bd7835681e5b4e5be667123 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Tue, 6 Jun 2017 17:22:16 +0200 Subject: [PATCH] Store the "showing latest messages" in a variable for later use --- src/widgets/chatwidgetview.cpp | 5 +---- src/widgets/chatwidgetview.h | 4 ++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/widgets/chatwidgetview.cpp b/src/widgets/chatwidgetview.cpp index 10b41ef1..dcc7377a 100644 --- a/src/widgets/chatwidgetview.cpp +++ b/src/widgets/chatwidgetview.cpp @@ -63,10 +63,7 @@ bool ChatWidgetView::layoutMessages() // True if one of the following statements are true: // The scrollbar was not visible // The scrollbar was visible and at the bottom - bool showingLatestMessages = false; - if (this->_scrollbar.isAtBottom() || !this->_scrollbar.isVisible()) { - showingLatestMessages = true; - } + this->showingLatestMessages = this->_scrollbar.isAtBottom() || !this->_scrollbar.isVisible(); int start = _scrollbar.getCurrentValue(); int layoutWidth = _scrollbar.isVisible() ? width() - _scrollbar.width() : width(); diff --git a/src/widgets/chatwidgetview.h b/src/widgets/chatwidgetview.h index be99d706..00af0351 100644 --- a/src/widgets/chatwidgetview.h +++ b/src/widgets/chatwidgetview.h @@ -52,6 +52,10 @@ private: ScrollBar _scrollbar; + // This variable can be used to decide whether or not we should render the "Show latest + // messages" button + bool showingLatestMessages = true; + AccountPopupWidget _userPopupWidget; bool _onlyUpdateEmotes;