mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Inject Emotes into TooltipWidget directly
This commit is contained in:
parent
8b79faf958
commit
94e705ec1b
1 changed files with 4 additions and 16 deletions
|
@ -1217,33 +1217,21 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto emoteElement = dynamic_cast<const EmoteElement*>(&hoverLayoutElement->getCreator());
|
tooltipWidget->clearImage();
|
||||||
|
|
||||||
|
auto emoteElement = dynamic_cast<const EmoteElement*>(&hoverLayoutElement->getCreator());
|
||||||
if (emoteElement && getSettings()->emotesTooltipPreview.getValue()) {
|
if (emoteElement && getSettings()->emotesTooltipPreview.getValue()) {
|
||||||
auto pixmap = emoteElement->getEmote()->images.getImage(3.0)->pixmap();
|
auto pixmap = emoteElement->getEmote()->images.getImage(3.0)->pixmap();
|
||||||
if (pixmap) {
|
if (pixmap) {
|
||||||
QBuffer buffer;
|
|
||||||
pixmap->save(&buffer, "PNG");
|
|
||||||
|
|
||||||
// FIXME: Inject image directly into tooltipWidget without base64 bs
|
|
||||||
// FIXME: Gifs are not animated
|
// FIXME: Gifs are not animated
|
||||||
|
tooltipWidget->setImage(*pixmap);
|
||||||
tooltipWidget->setText(
|
|
||||||
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 {
|
|
||||||
tooltipWidget->setText(tooltip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tooltipWidget->moveTo(this, event->globalPos());
|
tooltipWidget->moveTo(this, event->globalPos());
|
||||||
tooltipWidget->setWordWrap(isLinkValid);
|
tooltipWidget->setWordWrap(isLinkValid);
|
||||||
tooltipWidget->adjustSize();
|
tooltipWidget->adjustSize();
|
||||||
|
tooltipWidget->setText(tooltip);
|
||||||
tooltipWidget->show();
|
tooltipWidget->show();
|
||||||
tooltipWidget->raise();
|
tooltipWidget->raise();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue