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,21 +1217,27 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
} }
else else
{ {
if (auto pixmap = hoverLayoutElement->imagePreview()) { auto emoteElement = dynamic_cast<const EmoteElement*>(&hoverLayoutElement->getCreator());
QBuffer buffer;
pixmap->save(&buffer, "PNG");
// FIXME: Image inside of imageLayoutElement is not always the biggest if (emoteElement) {
// FIXME: Inject image directly into tooltipWidget without base64 bs auto pixmap = emoteElement->getEmote()->images.getImage(3.0)->pixmap();
// FIXME: Gifs are not animated if (pixmap) {
// FIXME: No way to opt-out QBuffer buffer;
pixmap->save(&buffer, "PNG");
tooltipWidget->setText( // FIXME: Inject image directly into tooltipWidget without base64 bs
QString("<img src='data:image/png;base64,%1' /><br/>%2x%3<br/>%4") // FIXME: Gifs are not animated
.arg(QString(buffer.data().toBase64())) // FIXME: No way to opt-out
.arg(pixmap->width())
.arg(pixmap->height()) tooltipWidget->setText(
.arg(tooltip)); QString("<img src='data:image/png;base64,%1' /><br/>%2x%3<br/>%4")
.arg(QString(buffer.data().toBase64()))
.arg(pixmap->width())
.arg(pixmap->height())
.arg(tooltip));
} else {
tooltipWidget->setText(tooltip);
}
} else { } else {
tooltipWidget->setText(tooltip); tooltipWidget->setText(tooltip);
} }