mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
(#976) Make currentPreviewImage shareable between ChannelView-s
This commit is contained in:
parent
e1a901aa98
commit
3f4d3ce14a
2 changed files with 9 additions and 6 deletions
|
@ -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<const EmoteElement*>(&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());
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue