diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 6a49d2f5b..657c2de0b 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -105,6 +105,8 @@ namespace { } } // namespace +ImagePtr ChannelView::currentPreviewImage = nullptr; + ChannelView::ChannelView(BaseWidget *parent) : BaseWidget(parent) , scrollBar_(new Scrollbar(this)) @@ -313,11 +315,13 @@ void ChannelView::queueUpdate() // this->repaint(); auto tooltipWidget = TooltipWidget::getInstance(); - if (this->currentPreviewImage) { - auto pixmap = this->currentPreviewImage->pixmap(); + if (ChannelView::currentPreviewImage) { + auto pixmap = ChannelView::currentPreviewImage->pixmap(); if (pixmap) { tooltipWidget->setImage(*pixmap); } + } else { + tooltipWidget->clearImage(); } this->update(); @@ -1228,10 +1232,9 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event) { auto emoteElement = dynamic_cast(&hoverLayoutElement->getCreator()); if (emoteElement && getSettings()->emotesTooltipPreview.getValue()) { - this->currentPreviewImage = emoteElement->getEmote()->images.getImage(3.0); + ChannelView::currentPreviewImage = emoteElement->getEmote()->images.getImage(3.0); } else { - this->currentPreviewImage = nullptr; - tooltipWidget->clearImage(); + ChannelView::currentPreviewImage = nullptr; } tooltipWidget->moveTo(this, event->globalPos()); diff --git a/src/widgets/helper/ChannelView.hpp b/src/widgets/helper/ChannelView.hpp index 58b296718..7a9a6e31d 100644 --- a/src/widgets/helper/ChannelView.hpp +++ b/src/widgets/helper/ChannelView.hpp @@ -210,7 +210,7 @@ private: static constexpr int leftPadding = 8; static constexpr int scrollbarPadding = 8; - ImagePtr currentPreviewImage = nullptr; + static ImagePtr currentPreviewImage; private slots: void wordFlagsChanged()