Extract TooltipWidget updating into a separate class
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "widgets/dialogs/UserInfoPopup.hpp"
|
||||
#include "widgets/helper/EffectLabel.hpp"
|
||||
#include "widgets/splits/Split.hpp"
|
||||
#include "TooltipPreviewImage.hpp"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QDebug>
|
||||
@@ -105,8 +106,6 @@ namespace {
|
||||
}
|
||||
} // namespace
|
||||
|
||||
ImagePtr ChannelView::currentPreviewImage = nullptr;
|
||||
|
||||
ChannelView::ChannelView(BaseWidget *parent)
|
||||
: BaseWidget(parent)
|
||||
, scrollBar_(new Scrollbar(this))
|
||||
@@ -314,16 +313,6 @@ void ChannelView::queueUpdate()
|
||||
|
||||
// this->repaint();
|
||||
|
||||
auto tooltipWidget = TooltipWidget::getInstance();
|
||||
if (ChannelView::currentPreviewImage) {
|
||||
auto pixmap = ChannelView::currentPreviewImage->pixmap();
|
||||
if (pixmap) {
|
||||
tooltipWidget->setImage(*pixmap);
|
||||
}
|
||||
} else {
|
||||
tooltipWidget->clearImage();
|
||||
}
|
||||
|
||||
this->update();
|
||||
|
||||
// this->updateTimer.start();
|
||||
@@ -1230,11 +1219,12 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
|
||||
}
|
||||
else
|
||||
{
|
||||
auto tooltipPreviewImage = TooltipPreviewImage::getInstance();
|
||||
auto emoteElement = dynamic_cast<const EmoteElement*>(&hoverLayoutElement->getCreator());
|
||||
if (emoteElement && getSettings()->emotesTooltipPreview.getValue()) {
|
||||
ChannelView::currentPreviewImage = emoteElement->getEmote()->images.getImage(3.0);
|
||||
tooltipPreviewImage->setImage(emoteElement->getEmote()->images.getImage(3.0));
|
||||
} else {
|
||||
ChannelView::currentPreviewImage = nullptr;
|
||||
tooltipPreviewImage->setImage(nullptr);
|
||||
}
|
||||
|
||||
tooltipWidget->moveTo(this, event->globalPos());
|
||||
|
||||
Reference in New Issue
Block a user