diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a05eeda..75096b5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unversioned +- Bugfix: Fixed visual glitch with smooth scrolling. (#2084) + ## 2.3.0 - Major: Added custom FrankerFaceZ VIP Badges. (#2628) diff --git a/src/widgets/Scrollbar.cpp b/src/widgets/Scrollbar.cpp index 399329b9..c581723b 100644 --- a/src/widgets/Scrollbar.cpp +++ b/src/widgets/Scrollbar.cpp @@ -188,6 +188,11 @@ qreal Scrollbar::getCurrentValue() const return this->currentValue_; } +const QPropertyAnimation &Scrollbar::getCurrentValueAnimation() const +{ + return this->currentValueAnimation_; +} + void Scrollbar::offset(qreal value) { if (this->currentValueAnimation_.state() == QPropertyAnimation::Running) diff --git a/src/widgets/Scrollbar.hpp b/src/widgets/Scrollbar.hpp index 09cbeb2c..ff6cbc76 100644 --- a/src/widgets/Scrollbar.hpp +++ b/src/widgets/Scrollbar.hpp @@ -44,6 +44,8 @@ public: qreal getDesiredValue() const; qreal getCurrentValue() const; + const QPropertyAnimation &getCurrentValueAnimation() const; + // offset the desired value without breaking smooth scolling void offset(qreal value); pajlada::Signals::NoArgSignal &getCurrentValueChanged(); diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 01e31338..f6715157 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -785,6 +785,18 @@ void ChannelView::messageAppended(MessagePtr &message, this->lastMessageHasAlternateBackground_ = !this->lastMessageHasAlternateBackground_; + if (!this->scrollBar_->isAtBottom() && + this->scrollBar_->getCurrentValueAnimation().state() == + QPropertyAnimation::Running) + { + QEventLoop loop; + + connect(&this->scrollBar_->getCurrentValueAnimation(), + &QAbstractAnimation::stateChanged, &loop, &QEventLoop::quit); + + loop.exec(); + } + if (this->messages_.pushBack(MessageLayoutPtr(messageRef), deleted)) { if (this->paused())