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>bb10
parent
5f1afeacf6
commit
4724dfff62
|
|
@ -567,7 +567,7 @@ void QAbstractTextDocumentLayoutPrivate::_q_handlerDestroyed(QObject *obj)
|
|||
*/
|
||||
int QAbstractTextDocumentLayout::formatIndex(int pos)
|
||||
{
|
||||
QTextDocumentPrivate *pieceTable = qobject_cast<QTextDocument *>(parent())->docHandle();
|
||||
QTextDocumentPrivate *pieceTable = QTextDocumentPrivate::get(qobject_cast<QTextDocument *>(parent()));
|
||||
return pieceTable->find(pos).value()->format;
|
||||
}
|
||||
|
||||
|
|
@ -578,7 +578,7 @@ int QAbstractTextDocumentLayout::formatIndex(int pos)
|
|||
*/
|
||||
QTextCharFormat QAbstractTextDocumentLayout::format(int pos)
|
||||
{
|
||||
QTextDocumentPrivate *pieceTable = qobject_cast<QTextDocument *>(parent())->docHandle();
|
||||
QTextDocumentPrivate *pieceTable = QTextDocumentPrivate::get(qobject_cast<QTextDocument *>(parent()));
|
||||
int idx = pieceTable->find(pos).value()->format;
|
||||
return pieceTable->formatCollection()->charFormat(idx);
|
||||
}
|
||||
|
|
@ -644,7 +644,7 @@ QTextFormat QAbstractTextDocumentLayout::formatAt(const QPointF &pos) const
|
|||
block = block.next();
|
||||
}
|
||||
|
||||
QTextDocumentPrivate *pieceTable = qobject_cast<const QTextDocument *>(parent())->docHandle();
|
||||
const QTextDocumentPrivate *pieceTable = QTextDocumentPrivate::get(qobject_cast<const QTextDocument *>(parent()));
|
||||
QTextDocumentPrivate::FragmentIterator it = pieceTable->find(cursorPos);
|
||||
return pieceTable->formatCollection()->format(it->format);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@
|
|||
|
||||
#include <QtGui/private/qtguiglobal_p.h>
|
||||
#include "private/qobject_p.h"
|
||||
#include "qtextdocument_p.h"
|
||||
#include "QtCore/qhash.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
|
@ -78,7 +79,7 @@ public:
|
|||
document = doc;
|
||||
docPrivate = nullptr;
|
||||
if (doc)
|
||||
docPrivate = doc->docHandle();
|
||||
docPrivate = QTextDocumentPrivate::get(doc);
|
||||
}
|
||||
|
||||
inline int _q_dynamicPageCountSlot() const
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ void QSyntaxHighlighterPrivate::reformatBlocks(int from, int charsRemoved, int c
|
|||
if (lastBlock.isValid())
|
||||
endPosition = lastBlock.position() + lastBlock.length();
|
||||
else
|
||||
endPosition = doc->docHandle()->length();
|
||||
endPosition = QTextDocumentPrivate::get(doc)->length();
|
||||
|
||||
bool forceHighlightOfNextBlock = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include "qtextdocument.h"
|
||||
#include <qtextformat.h>
|
||||
#include "qtextcursor_p.h"
|
||||
#include "qtextdocument_p.h"
|
||||
#include "qtextdocumentlayout_p.h"
|
||||
#include "qtextdocumentfragment.h"
|
||||
#include "qtextdocumentfragment_p.h"
|
||||
|
|
@ -1328,7 +1329,8 @@ static bool findInBlock(const QTextBlock &block, const QString &expression, int
|
|||
}
|
||||
}
|
||||
//we have a hit, return the cursor for that.
|
||||
*cursor = QTextCursorPrivate::fromPosition(block.docHandle(), block.position() + idx);
|
||||
*cursor = QTextCursorPrivate::fromPosition(const_cast<QTextDocumentPrivate *>(QTextDocumentPrivate::get(block)),
|
||||
block.position() + idx);
|
||||
cursor->setPosition(cursor->position() + expression.length(), QTextCursor::KeepAnchor);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1448,7 +1450,8 @@ static bool findInBlock(const QTextBlock &block, const QRegExp &expression, int
|
|||
}
|
||||
}
|
||||
//we have a hit, return the cursor for that.
|
||||
*cursor = QTextCursorPrivate::fromPosition(block.docHandle(), block.position() + idx);
|
||||
*cursor = QTextCursorPrivate::fromPosition(const_cast<QTextDocumentPrivate *>(QTextDocumentPrivate::get(block)),
|
||||
block.position() + idx);
|
||||
cursor->setPosition(cursor->position() + expr.matchedLength(), QTextCursor::KeepAnchor);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1576,7 +1579,8 @@ static bool findInBlock(const QTextBlock &block, const QRegularExpression &expre
|
|||
}
|
||||
}
|
||||
//we have a hit, return the cursor for that.
|
||||
*cursor = QTextCursorPrivate::fromPosition(block.docHandle(), block.position() + idx);
|
||||
*cursor = QTextCursorPrivate::fromPosition(const_cast<QTextDocumentPrivate *>(QTextDocumentPrivate::get(block)),
|
||||
block.position() + idx);
|
||||
cursor->setPosition(cursor->position() + match.capturedLength(), QTextCursor::KeepAnchor);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1737,7 +1741,7 @@ QTextObject *QTextDocument::objectForFormat(const QTextFormat &f) const
|
|||
QTextBlock QTextDocument::findBlock(int pos) const
|
||||
{
|
||||
Q_D(const QTextDocument);
|
||||
return QTextBlock(docHandle(), d->blockMap().findNode(pos));
|
||||
return QTextBlock(const_cast<QTextDocumentPrivate *>(d), d->blockMap().findNode(pos));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -1749,7 +1753,7 @@ QTextBlock QTextDocument::findBlock(int pos) const
|
|||
QTextBlock QTextDocument::findBlockByNumber(int blockNumber) const
|
||||
{
|
||||
Q_D(const QTextDocument);
|
||||
return QTextBlock(docHandle(), d->blockMap().findNode(blockNumber, 1));
|
||||
return QTextBlock(const_cast<QTextDocumentPrivate *>(d), d->blockMap().findNode(blockNumber, 1));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -1761,7 +1765,7 @@ QTextBlock QTextDocument::findBlockByNumber(int blockNumber) const
|
|||
QTextBlock QTextDocument::findBlockByLineNumber(int lineNumber) const
|
||||
{
|
||||
Q_D(const QTextDocument);
|
||||
return QTextBlock(docHandle(), d->blockMap().findNode(lineNumber, 2));
|
||||
return QTextBlock(const_cast<QTextDocumentPrivate *>(d), d->blockMap().findNode(lineNumber, 2));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -1772,7 +1776,7 @@ QTextBlock QTextDocument::findBlockByLineNumber(int lineNumber) const
|
|||
QTextBlock QTextDocument::begin() const
|
||||
{
|
||||
Q_D(const QTextDocument);
|
||||
return QTextBlock(docHandle(), d->blockMap().begin().n);
|
||||
return QTextBlock(const_cast<QTextDocumentPrivate *>(d), d->blockMap().begin().n);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -1789,7 +1793,8 @@ QTextBlock QTextDocument::begin() const
|
|||
*/
|
||||
QTextBlock QTextDocument::end() const
|
||||
{
|
||||
return QTextBlock(docHandle(), 0);
|
||||
Q_D(const QTextDocument);
|
||||
return QTextBlock(const_cast<QTextDocumentPrivate *>(d), 0);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -1799,7 +1804,7 @@ QTextBlock QTextDocument::end() const
|
|||
QTextBlock QTextDocument::firstBlock() const
|
||||
{
|
||||
Q_D(const QTextDocument);
|
||||
return QTextBlock(docHandle(), d->blockMap().begin().n);
|
||||
return QTextBlock(const_cast<QTextDocumentPrivate *>(d), d->blockMap().begin().n);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -1809,7 +1814,7 @@ QTextBlock QTextDocument::firstBlock() const
|
|||
QTextBlock QTextDocument::lastBlock() const
|
||||
{
|
||||
Q_D(const QTextDocument);
|
||||
return QTextBlock(docHandle(), d->blockMap().last().n);
|
||||
return QTextBlock(const_cast<QTextDocumentPrivate *>(d), d->blockMap().last().n);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -1893,12 +1898,14 @@ QFont QTextDocument::defaultFont() const
|
|||
|
||||
bool QTextDocument::isModified() const
|
||||
{
|
||||
return docHandle()->isModified();
|
||||
Q_D(const QTextDocument);
|
||||
return d->isModified();
|
||||
}
|
||||
|
||||
void QTextDocument::setModified(bool m)
|
||||
{
|
||||
docHandle()->setModified(m);
|
||||
Q_D(QTextDocument);
|
||||
d->setModified(m);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_PRINTER
|
||||
|
|
@ -2319,7 +2326,7 @@ QString QTextHtmlExporter::toHtml(const QByteArray &encoding, ExportMode mode)
|
|||
html = QLatin1String("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" "
|
||||
"\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" />");
|
||||
html.reserve(doc->docHandle()->length());
|
||||
html.reserve(QTextDocumentPrivate::get(doc)->length());
|
||||
|
||||
fragmentMarkers = (mode == ExportFragment);
|
||||
|
||||
|
|
@ -2889,8 +2896,9 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
|
|||
int p = block.position();
|
||||
if (p > 0)
|
||||
--p;
|
||||
QTextDocumentPrivate::FragmentIterator frag = doc->docHandle()->find(p);
|
||||
QChar ch = doc->docHandle()->buffer().at(frag->stringPosition);
|
||||
|
||||
QTextDocumentPrivate::FragmentIterator frag = QTextDocumentPrivate::get(doc)->find(p);
|
||||
QChar ch = QTextDocumentPrivate::get(doc)->buffer().at(frag->stringPosition);
|
||||
if (ch == QTextBeginningOfFrame
|
||||
|| ch == QTextEndOfFrame)
|
||||
return;
|
||||
|
|
@ -3008,7 +3016,7 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
|
|||
for (; !it.atEnd(); ++it)
|
||||
emitFragment(it.fragment());
|
||||
|
||||
if (fragmentMarkers && block.position() + block.length() == doc->docHandle()->length())
|
||||
if (fragmentMarkers && block.position() + block.length() == QTextDocumentPrivate::get(doc)->length())
|
||||
html += QLatin1String("<!--EndFragment-->");
|
||||
|
||||
if (pre)
|
||||
|
|
@ -3046,27 +3054,27 @@ QString QTextHtmlExporter::findUrlForImage(const QTextDocument *doc, qint64 cach
|
|||
if (QTextDocument *parent = qobject_cast<QTextDocument *>(doc->parent()))
|
||||
return findUrlForImage(parent, cacheKey, isPixmap);
|
||||
|
||||
if (doc && doc->docHandle()) {
|
||||
QTextDocumentPrivate *priv = doc->docHandle();
|
||||
QMap<QUrl, QVariant>::const_iterator it = priv->cachedResources.constBegin();
|
||||
for (; it != priv->cachedResources.constEnd(); ++it) {
|
||||
const QTextDocumentPrivate *priv = QTextDocumentPrivate::get(doc);
|
||||
Q_ASSERT(priv != nullptr);
|
||||
|
||||
const QVariant &v = it.value();
|
||||
if (v.userType() == QMetaType::QImage && !isPixmap) {
|
||||
if (qvariant_cast<QImage>(v).cacheKey() == cacheKey)
|
||||
break;
|
||||
}
|
||||
QMap<QUrl, QVariant>::const_iterator it = priv->cachedResources.constBegin();
|
||||
for (; it != priv->cachedResources.constEnd(); ++it) {
|
||||
|
||||
if (v.userType() == QMetaType::QPixmap && isPixmap) {
|
||||
if (qvariant_cast<QPixmap>(v).cacheKey() == cacheKey)
|
||||
break;
|
||||
}
|
||||
const QVariant &v = it.value();
|
||||
if (v.userType() == QMetaType::QImage && !isPixmap) {
|
||||
if (qvariant_cast<QImage>(v).cacheKey() == cacheKey)
|
||||
break;
|
||||
}
|
||||
|
||||
if (it != priv->cachedResources.constEnd())
|
||||
url = it.key().toString();
|
||||
if (v.userType() == QMetaType::QPixmap && isPixmap) {
|
||||
if (qvariant_cast<QPixmap>(v).cacheKey() == cacheKey)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (it != priv->cachedResources.constEnd())
|
||||
url = it.key().toString();
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
|
|
@ -3435,18 +3443,6 @@ QVector<QTextFormat> QTextDocument::allFormats() const
|
|||
return d->formatCollection()->formats;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
So that not all classes have to be friends of each other...
|
||||
*/
|
||||
QTextDocumentPrivate *QTextDocument::docHandle() const
|
||||
{
|
||||
Q_D(const QTextDocument);
|
||||
return const_cast<QTextDocumentPrivate *>(d);
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.4
|
||||
\fn QTextDocument::undoCommandAdded()
|
||||
|
|
|
|||
|
|
@ -316,8 +316,6 @@ protected:
|
|||
Q_INVOKABLE virtual QVariant loadResource(int type, const QUrl &name);
|
||||
|
||||
QTextDocument(QTextDocumentPrivate &dd, QObject *parent);
|
||||
public:
|
||||
QTextDocumentPrivate *docHandle() const;
|
||||
private:
|
||||
Q_DISABLE_COPY(QTextDocument)
|
||||
Q_DECLARE_PRIVATE(QTextDocument)
|
||||
|
|
|
|||
|
|
@ -295,6 +295,36 @@ public:
|
|||
|
||||
bool ensureMaximumBlockCount();
|
||||
|
||||
static inline const QTextDocumentPrivate *get(const QTextDocument *document)
|
||||
{
|
||||
return document->d_func();
|
||||
}
|
||||
|
||||
static inline QTextDocumentPrivate *get(QTextDocument *document)
|
||||
{
|
||||
return document->d_func();
|
||||
}
|
||||
|
||||
static inline QTextDocumentPrivate *get(QTextBlock &block)
|
||||
{
|
||||
return block.p;
|
||||
}
|
||||
|
||||
static inline const QTextDocumentPrivate *get(const QTextBlock &block)
|
||||
{
|
||||
return block.p;
|
||||
}
|
||||
|
||||
static inline QTextDocumentPrivate *get(QTextObject *object)
|
||||
{
|
||||
return get(object->document());
|
||||
}
|
||||
|
||||
static inline const QTextDocumentPrivate *get(const QTextObject *object)
|
||||
{
|
||||
return get(object->document());
|
||||
}
|
||||
|
||||
private:
|
||||
QTextDocumentPrivate(const QTextDocumentPrivate& m);
|
||||
QTextDocumentPrivate& operator= (const QTextDocumentPrivate& m);
|
||||
|
|
|
|||
|
|
@ -224,13 +224,14 @@ QTextDocumentFragmentPrivate::QTextDocumentFragmentPrivate(const QTextCursor &_c
|
|||
if (!_cursor.hasSelection())
|
||||
return;
|
||||
|
||||
doc->docHandle()->beginEditBlock();
|
||||
QTextDocumentPrivate *p = QTextDocumentPrivate::get(doc);
|
||||
p->beginEditBlock();
|
||||
QTextCursor destCursor(doc);
|
||||
QTextCopyHelper(_cursor, destCursor).copy();
|
||||
doc->docHandle()->endEditBlock();
|
||||
p->endEditBlock();
|
||||
|
||||
if (_cursor.d)
|
||||
doc->docHandle()->mergeCachedResources(_cursor.d->priv);
|
||||
p->mergeCachedResources(_cursor.d->priv);
|
||||
}
|
||||
|
||||
void QTextDocumentFragmentPrivate::insert(QTextCursor &_cursor) const
|
||||
|
|
@ -353,7 +354,7 @@ QTextDocumentFragment::~QTextDocumentFragment()
|
|||
*/
|
||||
bool QTextDocumentFragment::isEmpty() const
|
||||
{
|
||||
return !d || !d->doc || d->doc->docHandle()->length() <= 1;
|
||||
return d == nullptr || d->doc == nullptr || QTextDocumentPrivate::get(d->doc)->length() <= 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -3400,7 +3400,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout
|
|||
} else {
|
||||
currentLazyLayoutPosition = checkPoints.constLast().positionInFrame;
|
||||
// #######
|
||||
//checkPoints.last().positionInFrame = q->document()->docHandle()->length();
|
||||
//checkPoints.last().positionInFrame = QTextDocumentPrivate::get(q->document())->length();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4146,7 +4146,7 @@ int QTextDocumentLayout::layoutStatus() const
|
|||
int pos = d->currentLazyLayoutPosition;
|
||||
if (pos == -1)
|
||||
return 100;
|
||||
return pos * 100 / d->document->docHandle()->length();
|
||||
return pos * 100 / QTextDocumentPrivate::get(d->document)->length();
|
||||
}
|
||||
|
||||
void QTextDocumentLayout::timerEvent(QTimerEvent *e)
|
||||
|
|
|
|||
|
|
@ -1984,7 +1984,7 @@ void QTextEngine::shape(int item) const
|
|||
auto &li = layoutData->items[item];
|
||||
if (li.analysis.flags == QScriptAnalysis::Object) {
|
||||
ensureSpace(1);
|
||||
if (block.docHandle()) {
|
||||
if (QTextDocumentPrivate::get(block) != nullptr) {
|
||||
docLayout()->resizeInlineObject(QTextInlineObject(item, const_cast<QTextEngine *>(this)),
|
||||
li.position + block.position(),
|
||||
format(&li));
|
||||
|
|
@ -2040,7 +2040,7 @@ void QTextEngine::validate() const
|
|||
if (layoutData)
|
||||
return;
|
||||
layoutData = new LayoutData();
|
||||
if (block.docHandle()) {
|
||||
if (QTextDocumentPrivate::get(block) != nullptr) {
|
||||
layoutData->string = block.text();
|
||||
const bool nextBlockValid = block.next().isValid();
|
||||
if (!nextBlockValid && option.flags() & QTextOption::ShowDocumentTerminator) {
|
||||
|
|
@ -2135,7 +2135,7 @@ void QTextEngine::itemize() const
|
|||
|
||||
Itemizer itemizer(layoutData->string, scriptAnalysis.data(), layoutData->items);
|
||||
|
||||
const QTextDocumentPrivate *p = block.docHandle();
|
||||
const QTextDocumentPrivate *p = QTextDocumentPrivate::get(block);
|
||||
if (p) {
|
||||
SpecialData *s = specialData;
|
||||
|
||||
|
|
@ -2413,9 +2413,10 @@ QFont QTextEngine::font(const QScriptItem &si) const
|
|||
QTextCharFormat f = format(&si);
|
||||
font = f.font();
|
||||
|
||||
if (block.docHandle() && block.docHandle()->layout()) {
|
||||
const QTextDocumentPrivate *document_d = QTextDocumentPrivate::get(block);
|
||||
if (document_d != nullptr && document_d->layout() != nullptr) {
|
||||
// Make sure we get the right dpi on printers
|
||||
QPaintDevice *pdev = block.docHandle()->layout()->paintDevice();
|
||||
QPaintDevice *pdev = document_d->layout()->paintDevice();
|
||||
if (pdev)
|
||||
font = QFont(font, pdev);
|
||||
} else {
|
||||
|
|
@ -2490,9 +2491,9 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
|
|||
QTextCharFormat f = format(&si);
|
||||
font = f.font();
|
||||
|
||||
if (block.docHandle() && block.docHandle()->layout()) {
|
||||
if (QTextDocumentPrivate::get(block) != nullptr && QTextDocumentPrivate::get(block)->layout() != nullptr) {
|
||||
// Make sure we get the right dpi on printers
|
||||
QPaintDevice *pdev = block.docHandle()->layout()->paintDevice();
|
||||
QPaintDevice *pdev = QTextDocumentPrivate::get(block)->layout()->paintDevice();
|
||||
if (pdev)
|
||||
font = QFont(font, pdev);
|
||||
} else {
|
||||
|
|
@ -2789,10 +2790,10 @@ void QScriptLine::setDefaultHeight(QTextEngine *eng)
|
|||
QFont f;
|
||||
QFontEngine *e;
|
||||
|
||||
if (eng->block.docHandle() && eng->block.docHandle()->layout()) {
|
||||
if (QTextDocumentPrivate::get(eng->block) != nullptr && QTextDocumentPrivate::get(eng->block)->layout() != nullptr) {
|
||||
f = eng->block.charFormat().font();
|
||||
// Make sure we get the right dpi on printers
|
||||
QPaintDevice *pdev = eng->block.docHandle()->layout()->paintDevice();
|
||||
QPaintDevice *pdev = QTextDocumentPrivate::get(eng->block)->layout()->paintDevice();
|
||||
if (pdev)
|
||||
f = QFont(f, pdev);
|
||||
e = f.d->engineForScript(QChar::Script_Common);
|
||||
|
|
@ -2954,7 +2955,7 @@ int QTextEngine::formatIndex(const QScriptItem *si) const
|
|||
return collection->indexForFormat(specialData->resolvedFormats.at(si - &layoutData->items.at(0)));
|
||||
}
|
||||
|
||||
QTextDocumentPrivate *p = block.docHandle();
|
||||
const QTextDocumentPrivate *p = QTextDocumentPrivate::get(block);
|
||||
if (!p)
|
||||
return -1;
|
||||
int pos = si->position;
|
||||
|
|
@ -3079,7 +3080,7 @@ void QTextEngine::indexFormats()
|
|||
{
|
||||
QTextFormatCollection *collection = formatCollection();
|
||||
if (!collection) {
|
||||
Q_ASSERT(!block.docHandle());
|
||||
Q_ASSERT(QTextDocumentPrivate::get(block) == nullptr);
|
||||
specialData->formatCollection.reset(new QTextFormatCollection);
|
||||
collection = specialData->formatCollection.data();
|
||||
}
|
||||
|
|
@ -3341,8 +3342,8 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const
|
|||
const QScriptItem &si = layoutData->items[item];
|
||||
|
||||
QFixed dpiScale = 1;
|
||||
if (block.docHandle() && block.docHandle()->layout()) {
|
||||
QPaintDevice *pdev = block.docHandle()->layout()->paintDevice();
|
||||
if (QTextDocumentPrivate::get(block) != nullptr && QTextDocumentPrivate::get(block)->layout() != nullptr) {
|
||||
QPaintDevice *pdev = QTextDocumentPrivate::get(block)->layout()->paintDevice();
|
||||
if (pdev)
|
||||
dpiScale = QFixed::fromReal(pdev->logicalDpiY() / qreal(qt_defaultDpiY()));
|
||||
} else {
|
||||
|
|
@ -3504,8 +3505,8 @@ void QTextEngine::resolveFormats() const
|
|||
}
|
||||
|
||||
QTextCharFormat &format = resolvedFormats[i];
|
||||
if (block.docHandle()) {
|
||||
// when we have a docHandle, formatIndex might still return a valid index based
|
||||
if (QTextDocumentPrivate::get(block) != nullptr) {
|
||||
// when we have a QTextDocumentPrivate, formatIndex might still return a valid index based
|
||||
// on the preeditPosition. for all other cases, we cleared the resolved format indices
|
||||
format = collection->charFormat(formatIndex(si));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1373,7 +1373,7 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration>
|
|||
|
||||
case QCss::QtForegroundTextureCacheKey:
|
||||
{
|
||||
if (resourceProvider != nullptr && resourceProvider->docHandle() != nullptr) {
|
||||
if (resourceProvider != nullptr && QTextDocumentPrivate::get(resourceProvider) != nullptr) {
|
||||
bool ok;
|
||||
qint64 searchKey = decl.d->values.first().variant.toLongLong(&ok);
|
||||
if (ok)
|
||||
|
|
@ -1415,7 +1415,7 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector<QCss::Declaration>
|
|||
|
||||
void QTextHtmlParserNode::applyForegroundImage(qint64 searchKey, const QTextDocument *resourceProvider)
|
||||
{
|
||||
QTextDocumentPrivate *priv = resourceProvider->docHandle();
|
||||
const QTextDocumentPrivate *priv = QTextDocumentPrivate::get(resourceProvider);
|
||||
for (int i = 0; i < priv->formats.numFormats(); ++i) {
|
||||
QTextCharFormat format = priv->formats.charFormat(i);
|
||||
if (format.isValid()) {
|
||||
|
|
@ -2110,7 +2110,7 @@ QVector<QCss::Declaration> QTextHtmlParser::declarationsForNode(int node) const
|
|||
+ externalStyleSheets.count()
|
||||
+ inlineStyleSheets.count());
|
||||
if (resourceProvider)
|
||||
selector.styleSheets[idx++] = resourceProvider->docHandle()->parsedDefaultStyleSheet;
|
||||
selector.styleSheets[idx++] = QTextDocumentPrivate::get(resourceProvider)->parsedDefaultStyleSheet;
|
||||
|
||||
for (int i = 0; i < externalStyleSheets.count(); ++i, ++idx)
|
||||
selector.styleSheets[idx] = externalStyleSheets.at(i).sheet;
|
||||
|
|
|
|||
|
|
@ -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<FormatRange> &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;
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ void QTextList::remove(const QTextBlock &block)
|
|||
QTextBlockFormat fmt = block.blockFormat();
|
||||
fmt.setIndent(fmt.indent() + format().indent());
|
||||
fmt.setObjectIndex(-1);
|
||||
block.docHandle()->setBlockFormat(block, block, fmt, QTextDocumentPrivate::SetFormat);
|
||||
const_cast<QTextDocumentPrivate *>(QTextDocumentPrivate::get(block))->setBlockFormat(block, block, fmt, QTextDocumentPrivate::SetFormat);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -316,7 +316,7 @@ void QTextList::add(const QTextBlock &block)
|
|||
{
|
||||
QTextBlockFormat fmt = block.blockFormat();
|
||||
fmt.setObjectIndex(objectIndex());
|
||||
block.docHandle()->setBlockFormat(block, block, fmt, QTextDocumentPrivate::SetFormat);
|
||||
const_cast<QTextDocumentPrivate *>(QTextDocumentPrivate::get(block))->setBlockFormat(block, block, fmt, QTextDocumentPrivate::SetFormat);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -170,14 +170,6 @@ QTextDocument *QTextObject::document() const
|
|||
return static_cast<QTextDocument *>(parent());
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
QTextDocumentPrivate *QTextObject::docHandle() const
|
||||
{
|
||||
return static_cast<const QTextDocument *>(parent())->docHandle();
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QTextBlockGroup
|
||||
\reentrant
|
||||
|
|
@ -270,7 +262,7 @@ void QTextBlockGroup::blockRemoved(const QTextBlock &block)
|
|||
d->blocks.removeAll(block);
|
||||
d->markBlocksDirty();
|
||||
if (d->blocks.isEmpty()) {
|
||||
document()->docHandle()->deleteObject(this);
|
||||
QTextDocumentPrivate::get(document())->deleteObject(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -576,7 +568,7 @@ void QTextFramePrivate::remove_me()
|
|||
Q_Q(QTextFrame);
|
||||
if (fragment_start == 0 && fragment_end == 0
|
||||
&& !parentFrame) {
|
||||
q->document()->docHandle()->deleteObject(q);
|
||||
QTextDocumentPrivate::get(q->document())->deleteObject(q);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -630,7 +622,7 @@ void QTextFramePrivate::remove_me()
|
|||
*/
|
||||
QTextFrame::iterator QTextFrame::begin() const
|
||||
{
|
||||
const QTextDocumentPrivate *priv = docHandle();
|
||||
const QTextDocumentPrivate *priv = QTextDocumentPrivate::get(this);
|
||||
int b = priv->blockMap().findNode(firstPosition());
|
||||
int e = priv->blockMap().findNode(lastPosition()+1);
|
||||
return iterator(const_cast<QTextFrame *>(this), b, b, e);
|
||||
|
|
@ -643,7 +635,7 @@ QTextFrame::iterator QTextFrame::begin() const
|
|||
*/
|
||||
QTextFrame::iterator QTextFrame::end() const
|
||||
{
|
||||
const QTextDocumentPrivate *priv = docHandle();
|
||||
const QTextDocumentPrivate *priv = QTextDocumentPrivate::get(this);
|
||||
int b = priv->blockMap().findNode(firstPosition());
|
||||
int e = priv->blockMap().findNode(lastPosition()+1);
|
||||
return iterator(const_cast<QTextFrame *>(this), e, b, e);
|
||||
|
|
@ -724,7 +716,7 @@ QTextBlock QTextFrame::iterator::currentBlock() const
|
|||
{
|
||||
if (!f)
|
||||
return QTextBlock();
|
||||
return QTextBlock(f->docHandle(), cb);
|
||||
return QTextBlock(QTextDocumentPrivate::get(f), cb);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -734,7 +726,7 @@ QTextBlock QTextFrame::iterator::currentBlock() const
|
|||
*/
|
||||
QTextFrame::iterator &QTextFrame::iterator::operator++()
|
||||
{
|
||||
const QTextDocumentPrivate *priv = f->docHandle();
|
||||
const QTextDocumentPrivate *priv = QTextDocumentPrivate::get(f);
|
||||
const QTextDocumentPrivate::BlockMap &map = priv->blockMap();
|
||||
if (cf) {
|
||||
int end = cf->lastPosition() + 1;
|
||||
|
|
@ -772,7 +764,7 @@ QTextFrame::iterator &QTextFrame::iterator::operator++()
|
|||
*/
|
||||
QTextFrame::iterator &QTextFrame::iterator::operator--()
|
||||
{
|
||||
const QTextDocumentPrivate *priv = f->docHandle();
|
||||
const QTextDocumentPrivate *priv = QTextDocumentPrivate::get(f);
|
||||
const QTextDocumentPrivate::BlockMap &map = priv->blockMap();
|
||||
if (cf) {
|
||||
int start = cf->firstPosition() - 1;
|
||||
|
|
@ -1013,12 +1005,6 @@ bool QTextBlock::isValid() const
|
|||
returns an iterator to the old current item.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QTextDocumentPrivate *QTextBlock::docHandle() const
|
||||
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QTextBlock::fragmentIndex() const
|
||||
|
||||
|
|
|
|||
|
|
@ -75,8 +75,6 @@ public:
|
|||
|
||||
int objectIndex() const;
|
||||
|
||||
QTextDocumentPrivate *docHandle() const;
|
||||
|
||||
protected:
|
||||
QTextObject(QTextObjectPrivate &p, QTextDocument *doc);
|
||||
|
||||
|
|
@ -287,7 +285,6 @@ public:
|
|||
QTextBlock next() const;
|
||||
QTextBlock previous() const;
|
||||
|
||||
inline QTextDocumentPrivate *docHandle() const { return p; }
|
||||
inline int fragmentIndex() const { return n; }
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1036,16 +1036,16 @@ bool QTextOdfWriter::writeAll()
|
|||
writer.writeAttribute(officeNS, QString::fromLatin1("version"), QString::fromLatin1("1.2"));
|
||||
|
||||
// add fragments. (for character formats)
|
||||
QTextDocumentPrivate::FragmentIterator fragIt = m_document->docHandle()->begin();
|
||||
QTextDocumentPrivate::FragmentIterator fragIt = QTextDocumentPrivate::get(m_document)->begin();
|
||||
QSet<int> formats;
|
||||
while (fragIt != m_document->docHandle()->end()) {
|
||||
while (fragIt != QTextDocumentPrivate::get(m_document)->end()) {
|
||||
const QTextFragmentData * const frag = fragIt.value();
|
||||
formats << frag->format;
|
||||
++fragIt;
|
||||
}
|
||||
|
||||
// add blocks (for blockFormats)
|
||||
QTextDocumentPrivate::BlockMap &blocks = m_document->docHandle()->blockMap();
|
||||
QTextDocumentPrivate::BlockMap &blocks = const_cast<QTextDocumentPrivate *>(QTextDocumentPrivate::get(m_document))->blockMap();
|
||||
QTextDocumentPrivate::BlockMap::Iterator blockIt = blocks.begin();
|
||||
while (blockIt != blocks.end()) {
|
||||
const QTextBlockData * const block = blockIt.value();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -1430,7 +1430,7 @@ QString QPlainTextEdit::anchorAt(const QPoint &pos) const
|
|||
if (cursorPos < 0)
|
||||
return QString();
|
||||
|
||||
QTextDocumentPrivate *pieceTable = document()->docHandle();
|
||||
QTextDocumentPrivate *pieceTable = QTextDocumentPrivate::get(document());
|
||||
QTextDocumentPrivate::FragmentIterator it = pieceTable->find(cursorPos);
|
||||
QTextCharFormat fmt = pieceTable->formatCollection()->charFormat(it->format);
|
||||
return fmt.anchorHref();
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ void tst_QTextBlock::fragmentOverBlockBoundaries()
|
|||
// Block separators are always a fragment of their self. Thus:
|
||||
// |Hello|\b|World|\b|
|
||||
#if !defined(Q_OS_WIN)
|
||||
QCOMPARE(doc->docHandle()->fragmentMap().numNodes(), 4);
|
||||
QCOMPARE(QTextDocumentPrivate::get(doc)->fragmentMap().numNodes(), 4);
|
||||
#endif
|
||||
QCOMPARE(cursor.block().text(), QString("Hello"));
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
|
|
|
|||
|
|
@ -1280,7 +1280,7 @@ void tst_QTextCursor::anchorInitialized1()
|
|||
void tst_QTextCursor::anchorInitialized2()
|
||||
{
|
||||
cursor.insertBlock();
|
||||
cursor = QTextCursorPrivate::fromPosition(cursor.block().docHandle(), 1);
|
||||
cursor = QTextCursorPrivate::fromPosition(const_cast<QTextDocumentPrivate *>(QTextDocumentPrivate::get(cursor.block())), 1);
|
||||
QCOMPARE(cursor.position(), 1);
|
||||
QCOMPARE(cursor.anchor(), 1);
|
||||
QCOMPARE(cursor.selectionStart(), 1);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public:
|
|||
virtual void documentChanged(int from, int oldLength, int length)
|
||||
{
|
||||
called = true;
|
||||
lastDocumentLengths.append(document()->docHandle()->length());
|
||||
lastDocumentLengths.append(QTextDocumentPrivate::get(document())->length());
|
||||
|
||||
if (f < 0)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ tst_QTextPieceTable::tst_QTextPieceTable()
|
|||
void tst_QTextPieceTable::init()
|
||||
{
|
||||
doc = new QTextDocument(0);
|
||||
table = doc->docHandle();
|
||||
table = QTextDocumentPrivate::get(doc);
|
||||
blockFormatIndex = table->formatCollection()->indexForFormat(QTextBlockFormat());
|
||||
charFormatIndex = table->formatCollection()->indexForFormat(QTextCharFormat());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue