From 94e705ec1bcf86f75defc77f4de094d135cb82a7 Mon Sep 17 00:00:00 2001 From: rexim Date: Wed, 29 May 2019 00:58:14 +0700 Subject: [PATCH] Inject Emotes into TooltipWidget directly --- src/widgets/helper/ChannelView.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 61b047380..1f0147f35 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -1217,33 +1217,21 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event) } else { - auto emoteElement = dynamic_cast(&hoverLayoutElement->getCreator()); + tooltipWidget->clearImage(); + auto emoteElement = dynamic_cast(&hoverLayoutElement->getCreator()); if (emoteElement && getSettings()->emotesTooltipPreview.getValue()) { auto pixmap = emoteElement->getEmote()->images.getImage(3.0)->pixmap(); if (pixmap) { - QBuffer buffer; - pixmap->save(&buffer, "PNG"); - - // FIXME: Inject image directly into tooltipWidget without base64 bs // FIXME: Gifs are not animated - - tooltipWidget->setText( - QString("
%2x%3
%4") - .arg(QString(buffer.data().toBase64())) - .arg(pixmap->width()) - .arg(pixmap->height()) - .arg(tooltip)); - } else { - tooltipWidget->setText(tooltip); + tooltipWidget->setImage(*pixmap); } - } else { - tooltipWidget->setText(tooltip); } tooltipWidget->moveTo(this, event->globalPos()); tooltipWidget->setWordWrap(isLinkValid); tooltipWidget->adjustSize(); + tooltipWidget->setText(tooltip); tooltipWidget->show(); tooltipWidget->raise(); }