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/qtexttable.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/gui/text/qtexttable.cpp') diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp index 39f26d5d42..ceef4d785a 100644 --- a/src/gui/text/qtexttable.cpp +++ b/src/gui/text/qtexttable.cpp @@ -121,7 +121,7 @@ void QTextTableCell::setFormat(const QTextCharFormat &format) QTextCharFormat fmt = format; fmt.clearProperty(QTextFormat::ObjectIndex); fmt.setObjectType(QTextFormat::TableCellObject); - QTextDocumentPrivate *p = table->docHandle(); + QTextDocumentPrivate *p = const_cast(QTextDocumentPrivate::get(table)); QTextDocumentPrivate::FragmentIterator frag(&p->fragmentMap(), fragment); QTextFormatCollection *c = p->formatCollection(); @@ -137,8 +137,8 @@ void QTextTableCell::setFormat(const QTextCharFormat &format) */ QTextCharFormat QTextTableCell::format() const { - QTextDocumentPrivate *p = table->docHandle(); - QTextFormatCollection *c = p->formatCollection(); + const QTextDocumentPrivate *p = QTextDocumentPrivate::get(table); + const QTextFormatCollection *c = p->formatCollection(); QTextCharFormat fmt = c->charFormat(tableCellFormatIndex()); fmt.setObjectType(QTextFormat::TableCellObject); @@ -154,7 +154,7 @@ QTextCharFormat QTextTableCell::format() const */ int QTextTableCell::tableCellFormatIndex() const { - QTextDocumentPrivate *p = table->docHandle(); + const QTextDocumentPrivate *p = QTextDocumentPrivate::get(table); return QTextDocumentPrivate::FragmentIterator(&p->fragmentMap(), fragment)->format; } @@ -248,7 +248,7 @@ QTextCursor QTextTableCell::lastCursorPosition() const */ int QTextTableCell::firstPosition() const { - QTextDocumentPrivate *p = table->docHandle(); + const QTextDocumentPrivate *p = QTextDocumentPrivate::get(table); return p->fragmentMap().position(fragment) + 1; } @@ -259,7 +259,7 @@ int QTextTableCell::firstPosition() const */ int QTextTableCell::lastPosition() const { - QTextDocumentPrivate *p = table->docHandle(); + const QTextDocumentPrivate *p = QTextDocumentPrivate::get(table); const QTextTablePrivate *td = table->d_func(); int index = table->d_func()->findCellIndex(fragment); int f; @@ -278,7 +278,7 @@ int QTextTableCell::lastPosition() const */ QTextFrame::iterator QTextTableCell::begin() const { - QTextDocumentPrivate *p = table->docHandle(); + const QTextDocumentPrivate *p = QTextDocumentPrivate::get(table); int b = p->blockMap().findNode(firstPosition()); int e = p->blockMap().findNode(lastPosition()+1); return QTextFrame::iterator(const_cast(table), b, b, e); @@ -291,7 +291,7 @@ QTextFrame::iterator QTextTableCell::begin() const */ QTextFrame::iterator QTextTableCell::end() const { - QTextDocumentPrivate *p = table->docHandle(); + const QTextDocumentPrivate *p = QTextDocumentPrivate::get(table); int b = p->blockMap().findNode(firstPosition()); int e = p->blockMap().findNode(lastPosition()+1); return QTextFrame::iterator(const_cast(table), e, b, e); -- cgit v1.2.3