diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2020-02-19 11:26:57 +0100 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2020-03-04 08:28:04 +0100 |
commit | 4724dfff627f3cd3754f5d4a827c6b6790a89955 (patch) | |
tree | fcd6dec7ba40e6bc438ac2fd24772606fbab6b96 /src/gui/text/qtextengine_p.h | |
parent | 5f1afeacf69c55495a51dc2cffbc6acf8f654239 (diff) |
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 <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/gui/text/qtextengine_p.h')
-rw-r--r-- | src/gui/text/qtextengine_p.h | 14 |
1 files changed, 7 insertions, 7 deletions
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<QTextFormatCollection *>(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<QTextLayout::FormatRange> formats() const { return specialData ? specialData->formats : QVector<QTextLayout::FormatRange>(); } void setFormats(const QVector<QTextLayout::FormatRange> &formats); @@ -609,7 +609,7 @@ private: QString preeditText; QVector<QTextLayout::FormatRange> formats; QVector<QTextCharFormat> resolvedFormats; - // only used when no docHandle is available + // only used when no QTextDocumentPrivate is available QScopedPointer<QTextFormatCollection> formatCollection; }; SpecialData *specialData; |