diff --git a/src/messages/MessageElement.cpp b/src/messages/MessageElement.cpp index 03240db45..907bcc54a 100644 --- a/src/messages/MessageElement.cpp +++ b/src/messages/MessageElement.cpp @@ -185,6 +185,11 @@ void BadgeElement::addToContainer(MessageLayoutContainer &container, } } +EmotePtr BadgeElement::getEmote() const +{ + return this->emote_; +} + // TEXT TextElement::TextElement(const QString &text, MessageElementFlags flags, const MessageColor &color, FontStyle style) diff --git a/src/messages/MessageElement.hpp b/src/messages/MessageElement.hpp index 95c7090d4..3259405a6 100644 --- a/src/messages/MessageElement.hpp +++ b/src/messages/MessageElement.hpp @@ -222,6 +222,8 @@ public: void addToContainer(MessageLayoutContainer &container, MessageElementFlags flags_) override; + EmotePtr getEmote() const; + private: EmotePtr emote_; }; diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 36f8dd8ec..3f936a9f3 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -1222,14 +1222,25 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event) auto &tooltipPreviewImage = TooltipPreviewImage::getInstance(); auto emoteElement = dynamic_cast( &hoverLayoutElement->getCreator()); + auto badgeElement = dynamic_cast( + &hoverLayoutElement->getCreator()); - if (emoteElement && getSettings()->emotesTooltipPreview.getValue()) + if ((badgeElement || emoteElement) && + getSettings()->emotesTooltipPreview.getValue()) { if (event->modifiers() == Qt::ShiftModifier || getSettings()->emotesTooltipPreview.getValue() == 1) { - tooltipPreviewImage.setImage( - emoteElement->getEmote()->images.getImage(3.0)); + if (emoteElement) + { + tooltipPreviewImage.setImage( + emoteElement->getEmote()->images.getImage(3.0)); + } + else if (badgeElement) + { + tooltipPreviewImage.setImage( + badgeElement->getEmote()->images.getImage(3.0)); + } } else {