- inline const QAbstractItemModel *model() const;
- inline ChatLine *chatLine() const;
- inline ChatScene *chatScene() const;
- inline int row() const;
- virtual ChatLineModel::ColumnType column() const = 0;
-
- // The boundingRect() is relative to the parent ChatLine
- inline QRectF boundingRect() const;
- inline qreal width() const;
- inline qreal height() const;
- inline QPointF pos() const;
- inline qreal x() const;
- inline qreal y() const;
-
- inline QPointF mapToLine(const QPointF &) const;
- inline QPointF mapFromLine(const QPointF &) const;
- inline QPointF mapToScene(const QPointF &) const;
- inline QPointF mapFromScene(const QPointF &) const;
-
- void initLayoutHelper(QTextLayout *layout, QTextOption::WrapMode, Qt::Alignment = Qt::AlignLeft) const;
- virtual inline void initLayout(QTextLayout *layout) const {
- initLayoutHelper(layout, QTextOption::NoWrap);
- doLayout(layout);
- }
- virtual void doLayout(QTextLayout *) const;
- virtual UiStyle::FormatList formatList() const;
-
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
- virtual inline int type() const { return ChatScene::ChatItemType; }
-
- QVariant data(int role) const;
-
- // selection stuff, to be called by the scene
- QString selection() const;
- void clearSelection();
- void setFullSelection();
- void continueSelecting(const QPointF &pos);
- bool hasSelection() const;
- bool isPosOverSelection(const QPointF &pos) const;
-
- QList<QRectF> findWords(const QString &searchWord, Qt::CaseSensitivity caseSensitive);
-
- virtual void addActionsToMenu(QMenu *menu, const QPointF &itemPos);
- virtual void handleClick(const QPointF &pos, ChatScene::ClickMode);
+ const QAbstractItemModel* model() const;
+ ChatLine* chatLine() const;
+ ChatScene* chatScene() const;
+ ChatView* chatView() const;
+ int row() const;
+ virtual ChatLineModel::ColumnType column() const = 0;
+
+ // The boundingRect() is relative to the parent ChatLine
+ inline QRectF boundingRect() const;
+ inline qreal width() const;
+ inline qreal height() const;
+ inline QPointF pos() const;
+ inline qreal x() const;
+ inline qreal y() const;
+
+ QPointF mapToLine(const QPointF&) const;
+ QPointF mapFromLine(const QPointF&) const;
+ QPointF mapToScene(const QPointF&) const;
+ QPointF mapFromScene(const QPointF&) const;
+
+ virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr);
+ virtual inline int type() const { return ChatScene::ChatItemType; }
+
+ QVariant data(int role) const;
+
+ // selection stuff, to be called by the scene
+ QString selection() const;
+ void clearSelection();
+ void setFullSelection();
+ void continueSelecting(const QPointF& pos);
+ bool hasSelection() const;
+ bool isPosOverSelection(const QPointF& pos) const;
+
+ QList<QRectF> findWords(const QString& searchWord, Qt::CaseSensitivity caseSensitive);
+
+ virtual void addActionsToMenu(QMenu* menu, const QPointF& itemPos);
+ virtual void handleClick(const QPointF& pos, ChatScene::ClickMode);
+
+ void initLayoutHelper(QTextLayout* layout, QTextOption::WrapMode, Qt::Alignment = Qt::AlignLeft) const;
+
+ //! Remove internally cached data
+ /** This removes e.g. the cached QTextLayout to avoid wasting space for nonvisible ChatLines
+ */
+ virtual void clearCache();