+ mutable QTextLayout* _cachedLayout;
+
+ // internal selection stuff
+ void setSelection(int start, int length);
+
+ friend class ChatLine;
+};
+
+// ************************************************************
+// TimestampChatItem
+// ************************************************************
+
+//! A ChatItem for the timestamp column
+class TimestampChatItem : public ChatItem
+{
+public:
+ TimestampChatItem(const QRectF& boundingRect, ChatLine* parent)
+ : ChatItem(boundingRect, parent)
+ {}
+ inline int type() const override { return ChatScene::TimestampChatItemType; }
+ inline ChatLineModel::ColumnType column() const override { return ChatLineModel::TimestampColumn; }
+};
+
+// ************************************************************
+// SenderChatItem
+// ************************************************************
+//! A ChatItem for the sender column
+class SenderChatItem : public ChatItem
+{
+public:
+ SenderChatItem(const QRectF& boundingRect, ChatLine* parent)
+ : ChatItem(boundingRect, parent)
+ {}
+ inline ChatLineModel::ColumnType column() const override { return ChatLineModel::SenderColumn; }
+ void handleClick(const QPointF& pos, ChatScene::ClickMode clickMode) override;
+
+protected:
+ void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
+ inline int type() const override { return ChatScene::SenderChatItemType; }
+ void initLayout(QTextLayout* layout) const override;
+};
+
+// ************************************************************
+// ContentsChatItem
+// ************************************************************
+struct ContentsChatItemPrivate;
+
+//! A ChatItem for the contents column
+class ContentsChatItem : public ChatItem
+{
+ Q_DECLARE_TR_FUNCTIONS(ContentsChatItem)
+
+public:
+ ContentsChatItem(const QPointF& pos, const qreal& width, ChatLine* parent);
+ ~ContentsChatItem() override;
+
+ inline int type() const override { return ChatScene::ContentsChatItemType; }
+
+ inline ChatLineModel::ColumnType column() const override { return ChatLineModel::ContentsColumn; }
+ QFontMetricsF* fontMetrics() const;
+
+ void clearCache() override;
+
+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;