Get the biggest version of emote from EmoteElement

This commit is contained in:
rexim 2019-05-22 02:14:41 +07:00
parent 959aa4616f
commit 7251a20dfb

View file

@ -1217,11 +1217,14 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
} }
else else
{ {
if (auto pixmap = hoverLayoutElement->imagePreview()) { auto emoteElement = dynamic_cast<const EmoteElement*>(&hoverLayoutElement->getCreator());
if (emoteElement) {
auto pixmap = emoteElement->getEmote()->images.getImage(3.0)->pixmap();
if (pixmap) {
QBuffer buffer; QBuffer buffer;
pixmap->save(&buffer, "PNG"); pixmap->save(&buffer, "PNG");
// FIXME: Image inside of imageLayoutElement is not always the biggest
// FIXME: Inject image directly into tooltipWidget without base64 bs // FIXME: Inject image directly into tooltipWidget without base64 bs
// FIXME: Gifs are not animated // FIXME: Gifs are not animated
// FIXME: No way to opt-out // FIXME: No way to opt-out
@ -1235,6 +1238,9 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
} else { } else {
tooltipWidget->setText(tooltip); tooltipWidget->setText(tooltip);
} }
} else {
tooltipWidget->setText(tooltip);
}
tooltipWidget->moveTo(this, event->globalPos()); tooltipWidget->moveTo(this, event->globalPos());
tooltipWidget->setWordWrap(isLinkValid); tooltipWidget->setWordWrap(isLinkValid);