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
|
} // namespace
|
||||||
|
|
||||||
|
ImagePtr ChannelView::currentPreviewImage = nullptr;
|
||||||
|
|
||||||
ChannelView::ChannelView(BaseWidget *parent)
|
ChannelView::ChannelView(BaseWidget *parent)
|
||||||
: BaseWidget(parent)
|
: BaseWidget(parent)
|
||||||
, scrollBar_(new Scrollbar(this))
|
, scrollBar_(new Scrollbar(this))
|
||||||
|
@ -313,11 +315,13 @@ void ChannelView::queueUpdate()
|
||||||
// this->repaint();
|
// this->repaint();
|
||||||
|
|
||||||
auto tooltipWidget = TooltipWidget::getInstance();
|
auto tooltipWidget = TooltipWidget::getInstance();
|
||||||
if (this->currentPreviewImage) {
|
if (ChannelView::currentPreviewImage) {
|
||||||
auto pixmap = this->currentPreviewImage->pixmap();
|
auto pixmap = ChannelView::currentPreviewImage->pixmap();
|
||||||
if (pixmap) {
|
if (pixmap) {
|
||||||
tooltipWidget->setImage(*pixmap);
|
tooltipWidget->setImage(*pixmap);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
tooltipWidget->clearImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
this->update();
|
this->update();
|
||||||
|
@ -1228,10 +1232,9 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
auto emoteElement = dynamic_cast<const EmoteElement*>(&hoverLayoutElement->getCreator());
|
auto emoteElement = dynamic_cast<const EmoteElement*>(&hoverLayoutElement->getCreator());
|
||||||
if (emoteElement && getSettings()->emotesTooltipPreview.getValue()) {
|
if (emoteElement && getSettings()->emotesTooltipPreview.getValue()) {
|
||||||
this->currentPreviewImage = emoteElement->getEmote()->images.getImage(3.0);
|
ChannelView::currentPreviewImage = emoteElement->getEmote()->images.getImage(3.0);
|
||||||
} else {
|
} else {
|
||||||
this->currentPreviewImage = nullptr;
|
ChannelView::currentPreviewImage = nullptr;
|
||||||
tooltipWidget->clearImage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tooltipWidget->moveTo(this, event->globalPos());
|
tooltipWidget->moveTo(this, event->globalPos());
|
||||||
|
|
|
@ -210,7 +210,7 @@ private:
|
||||||
static constexpr int leftPadding = 8;
|
static constexpr int leftPadding = 8;
|
||||||
static constexpr int scrollbarPadding = 8;
|
static constexpr int scrollbarPadding = 8;
|
||||||
|
|
||||||
ImagePtr currentPreviewImage = nullptr;
|
static ImagePtr currentPreviewImage;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void wordFlagsChanged()
|
void wordFlagsChanged()
|
||||||
|
|
Loading…
Reference in a new issue