diff options
author | mae <qt-info@nokia.com> | 2010-07-09 17:48:01 (GMT) |
---|---|---|
committer | mae <qt-info@nokia.com> | 2010-07-09 18:00:47 (GMT) |
commit | 6f6c25b61f6d83e86e93c5f82e2d699619d00d5e (patch) | |
tree | 89e136ceaa62995ded540729dbbd9eaa2c16ddf2 /src/gui/text/qtextdocument.cpp | |
parent | 7201ba64bc001791f769038f1801502baf415a8e (diff) | |
download | Qt-6f6c25b61f6d83e86e93c5f82e2d699619d00d5e.zip Qt-6f6c25b61f6d83e86e93c5f82e2d699619d00d5e.tar.gz Qt-6f6c25b61f6d83e86e93c5f82e2d699619d00d5e.tar.bz2 |
Fix QTextDocument::markContentsDirty()
The function markContentsDirty(from,length) is documented
to inform the document that it needs to lay out again
the part from from to from + length.
Trouble was that the function was implemented using
beginEditBlock()/endEditBlock(), which has the negative
side effect that it does increase the document's revision
number and emits all sorts of contentChanged() signals.
This did not matter from the one case where Qt uses the
method itself in QSyntaxHighlighter, because here a private
flag inContentsChange avoided the issue.
Without the change, we cannot implement semantic syntax
highlighting in creator without expensive extra selections
or triggering a full rehighlight via QSyntaxHighlighter.
Done-with: Roberto Raggi
Reviewed-by: Roberto Raggi
Diffstat (limited to 'src/gui/text/qtextdocument.cpp')
-rw-r--r-- | src/gui/text/qtextdocument.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index e0386f1..195dc28 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -583,11 +583,11 @@ void QTextDocument::setDefaultTextOption(const QTextOption &option) void QTextDocument::markContentsDirty(int from, int length) { Q_D(QTextDocument); - if (!d->inContentsChange) - d->beginEditBlock(); d->documentChange(from, length); - if (!d->inContentsChange) - d->endEditBlock(); + if (!d->inContentsChange) { + d->lout->documentChanged(d->docChangeFrom, d->docChangeOldLength, d->docChangeLength); + d->docChangeFrom = -1; + } } /*! |