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/qtexttable.cpp | |
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/qtexttable.cpp')
-rw-r--r-- | src/gui/text/qtexttable.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
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 *>(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<QTextTable *>(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<QTextTable *>(table), e, b, e); |