- ChatItem *_tsItem, *_senderItem, *_textItem;
- int _tsColWidth, _senderColWidth, _textColWidth;
-};
+ ChatItem* item(ChatLineModel::ColumnType);
+ ChatItem* itemAt(const QPointF& pos);
+ inline ChatItem* timestampItem() { return &_timestampItem; }
+ inline ChatItem* senderItem() { return &_senderItem; }
+ inline ContentsChatItem* contentsItem() { return &_contentsItem; }
+
+ void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
+ enum
+ {
+ Type = ChatScene::ChatLineType
+ };
+ inline int type() const override { return Type; }
+
+ // pos is relative to the parent ChatLine
+ void setFirstColumn(const qreal& timestampWidth, const qreal& senderWidth, const QPointF& senderPos);
+ // setSecondColumn and setGeometryByWidth both also relocate the chatline.
+ // the _bottom_ position is passed via linePos. linePos is updated to the top of the chatLine.
+ void setSecondColumn(const qreal& senderWidth, const qreal& contentsWidth, const QPointF& contentsPos, qreal& linePos);
+ void setGeometryByWidth(const qreal& width, const qreal& contentsWidth, qreal& linePos);
+
+ void setSelected(bool selected, ChatLineModel::ColumnType minColumn = ChatLineModel::ContentsColumn);
+ void setHighlighted(bool highlighted);
+
+ void clearCache();
+
+protected:
+ bool sceneEvent(QEvent* event) override;