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/qtextlayout.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/gui/text/qtextlayout.cpp') diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 02c42eaf03..3d7a097cd9 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -491,8 +491,8 @@ void QTextLayout::setPreeditArea(int position, const QString &text) return; d->setPreeditArea(position, text); - if (d->block.docHandle()) - d->block.docHandle()->documentChange(d->block.position(), d->block.length()); + if (QTextDocumentPrivate::get(d->block) != nullptr) + QTextDocumentPrivate::get(d->block)->documentChange(d->block.position(), d->block.length()); } /*! @@ -538,8 +538,8 @@ void QTextLayout::setFormats(const QVector &formats) { d->setFormats(formats); - if (d->block.docHandle()) - d->block.docHandle()->documentChange(d->block.position(), d->block.length()); + if (QTextDocumentPrivate::get(d->block) != nullptr) + QTextDocumentPrivate::get(d->block)->documentChange(d->block.position(), d->block.length()); } #if QT_DEPRECATED_SINCE(5, 6) @@ -1913,7 +1913,7 @@ void QTextLine::layout_helper(int maxGlyphs) lbh.whiteSpaceOrObject = true; lbh.tmpData.length++; - if (eng->block.docHandle()) { + if (QTextDocumentPrivate::get(eng->block) != nullptr) { QTextInlineObject inlineObject(item, eng); QTextFormat f = inlineObject.format(); eng->docLayout()->positionInlineObject(inlineObject, eng->block.position() + current.position, f); @@ -2062,7 +2062,7 @@ found: line += lbh.tmpData; } - if (hasInlineObject && eng->block.docHandle()) { + if (hasInlineObject && QTextDocumentPrivate::get(eng->block) != nullptr) { // position top/bottom aligned inline objects if (maxInlineObjectHeight > line.ascent + line.descent) { // extend line height if required @@ -2568,7 +2568,7 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR if (eng->hasFormats()) { p->save(); - if (si.analysis.flags == QScriptAnalysis::Object && eng->block.docHandle()) { + if (si.analysis.flags == QScriptAnalysis::Object && QTextDocumentPrivate::get(eng->block)) { QFixed itemY = y - si.ascent; if (format.verticalAlignment() == QTextCharFormat::AlignTop) { itemY = y - lineBase; -- cgit v1.2.3