From 4724dfff627f3cd3754f5d4a827c6b6790a89955 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 19 Feb 2020 11:26:57 +0100 Subject: Remove references to QTextDocumentPrivate from public API The private object of QTextDocument has been exposed through public APIs marked internal, which we should avoid as much as possible, since it clutters the headers. For accessing private data without adding friends, we have a nice pattern of adding a static get() function to the private class itself. Fixes: QTBUG-55059 Change-Id: I03e949a677e03487e95f24e3608a06aa0a3511ab Reviewed-by: Konstantin Ritt Reviewed-by: Simon Hausmann --- src/gui/text/qtextengine_p.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/gui/text/qtextengine_p.h') diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index f069951ce5..84c983160f 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -525,14 +525,14 @@ public: int findItem(int strPos, int firstItem = 0) const; inline QTextFormatCollection *formatCollection() const { - if (block.docHandle()) - return block.docHandle()->formatCollection(); + if (QTextDocumentPrivate::get(block) != nullptr) + return const_cast(QTextDocumentPrivate::get(block)->formatCollection()); return specialData ? specialData->formatCollection.data() : nullptr; } QTextCharFormat format(const QScriptItem *si) const; inline QAbstractTextDocumentLayout *docLayout() const { - Q_ASSERT(block.docHandle()); - return block.docHandle()->document()->documentLayout(); + Q_ASSERT(QTextDocumentPrivate::get(block) != nullptr); + return QTextDocumentPrivate::get(block)->document()->documentLayout(); } int formatIndex(const QScriptItem *si) const; @@ -589,14 +589,14 @@ public: ItemDecorationList overlineList; inline bool visualCursorMovement() const - { return visualMovement || (block.docHandle() && block.docHandle()->defaultCursorMoveStyle == Qt::VisualMoveStyle); } + { return visualMovement || (QTextDocumentPrivate::get(block) != nullptr && QTextDocumentPrivate::get(block)->defaultCursorMoveStyle == Qt::VisualMoveStyle); } inline int preeditAreaPosition() const { return specialData ? specialData->preeditPosition : -1; } inline QString preeditAreaText() const { return specialData ? specialData->preeditText : QString(); } void setPreeditArea(int position, const QString &text); inline bool hasFormats() const - { return block.docHandle() || (specialData && !specialData->formats.isEmpty()); } + { return QTextDocumentPrivate::get(block) != nullptr || (specialData && !specialData->formats.isEmpty()); } inline QVector formats() const { return specialData ? specialData->formats : QVector(); } void setFormats(const QVector &formats); @@ -609,7 +609,7 @@ private: QString preeditText; QVector formats; QVector resolvedFormats; - // only used when no docHandle is available + // only used when no QTextDocumentPrivate is available QScopedPointer formatCollection; }; SpecialData *specialData; -- cgit v1.2.3