+protected:
+ void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent* event) override;
+ void hoverMoveEvent(QGraphicsSceneHoverEvent* event) override;
+ void handleClick(const QPointF& pos, ChatScene::ClickMode clickMode) override;
+
+ bool hasActiveClickable() const override;
+ std::pair<quint16, quint16> activeClickableRange() const override;
+
+ void addActionsToMenu(QMenu* menu, const QPointF& itemPos) override;
+ virtual void copyLinkToClipboard();
+
+ void initLayout(QTextLayout* layout) const override;
+ void doLayout(QTextLayout* layout) const override;
+ UiStyle::FormatList formatList() const override;
+
+private:
+ class ActionProxy;
+ class WrapColumnFinder;
+
+ mutable ContentsChatItemPrivate* _data;
+ ContentsChatItemPrivate* privateData() const;
+
+ Clickable clickableAt(const QPointF& pos) const;
+
+ void endHoverMode();
+ void showWebPreview(const Clickable& click);
+ void clearWebPreview();
+
+ qreal setGeometryByWidth(qreal w);
+
+ QFontMetricsF* _fontMetrics;
+
+ // we need a receiver for Action signals
+ static ActionProxy _actionProxy;
+
+ friend class ChatLine;
+ friend struct ContentsChatItemPrivate;
+};
+
+struct ContentsChatItemPrivate
+{
+ ContentsChatItem* contentsItem;
+ ClickableList clickables;
+ Clickable currentClickable;
+ Clickable activeClickable;
+
+ ContentsChatItemPrivate(ClickableList c, ContentsChatItem* parent)
+ : contentsItem(parent)
+ , clickables(std::move(c))
+ {}
+};
+
+class ContentsChatItem::WrapColumnFinder
+{
+public:
+ WrapColumnFinder(const ChatItem* parent);
+
+ qint16 nextWrapColumn(qreal width);
+
+private:
+ const ChatItem* item;
+ QTextLayout layout;