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/qtextcursor.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/qtextcursor.cpp')
-rw-r--r-- | src/gui/text/qtextcursor.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index fa323ef4bd..c579eca1ff 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -1052,7 +1052,7 @@ QTextCursor::QTextCursor() Constructs a cursor pointing to the beginning of the \a document. */ QTextCursor::QTextCursor(QTextDocument *document) - : d(new QTextCursorPrivate(document->docHandle())) + : d(new QTextCursorPrivate(QTextDocumentPrivate::get(document))) { } @@ -1060,7 +1060,7 @@ QTextCursor::QTextCursor(QTextDocument *document) Constructs a cursor pointing to the beginning of the \a frame. */ QTextCursor::QTextCursor(QTextFrame *frame) - : d(new QTextCursorPrivate(frame->document()->docHandle())) + : d(new QTextCursorPrivate(QTextDocumentPrivate::get(frame->document()))) { d->adjusted_anchor = d->anchor = d->position = frame->firstPosition(); } @@ -1070,7 +1070,7 @@ QTextCursor::QTextCursor(QTextFrame *frame) Constructs a cursor pointing to the beginning of the \a block. */ QTextCursor::QTextCursor(const QTextBlock &block) - : d(new QTextCursorPrivate(block.docHandle())) + : d(new QTextCursorPrivate(const_cast<QTextDocumentPrivate *>(QTextDocumentPrivate::get(block)))) { d->adjusted_anchor = d->anchor = d->position = block.position(); } @@ -2264,7 +2264,7 @@ void QTextCursor::insertFragment(const QTextDocumentFragment &fragment) d->setX(); if (fragment.d && fragment.d->doc) - d->priv->mergeCachedResources(fragment.d->doc->docHandle()); + d->priv->mergeCachedResources(QTextDocumentPrivate::get(fragment.d->doc)); } /*! |