diff options
author | mae <qt-info@nokia.com> | 2009-09-24 13:17:08 (GMT) |
---|---|---|
committer | mae <qt-info@nokia.com> | 2009-09-24 13:20:39 (GMT) |
commit | 930ba91ec1e63067c2ad79eb8d18ff56b78aa500 (patch) | |
tree | 9d1aaf6d9c3b54f3f34f8379fccf3c16572afce3 | |
parent | 240f69a0b26601fe34fe2a692ab50e5d738f02f9 (diff) | |
download | Qt-930ba91ec1e63067c2ad79eb8d18ff56b78aa500.zip Qt-930ba91ec1e63067c2ad79eb8d18ff56b78aa500.tar.gz Qt-930ba91ec1e63067c2ad79eb8d18ff56b78aa500.tar.bz2 |
QTextDocument initial revision after setPlainText/setHtml
After separating document revisions from the undo stack, the initial
revision after setText/setHtml could get to high. Now it's +1 from
the previous revision
-rw-r--r-- | src/gui/text/qtextdocument.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 5540958..a8956b8 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -1096,8 +1096,10 @@ void QTextDocument::setPlainText(const QString &text) Q_D(QTextDocument); bool previousState = d->isUndoRedoEnabled(); d->enableUndoRedo(false); + d->beginEditBlock(); d->clear(); QTextCursor(this).insertText(text); + d->endEditBlock(); d->enableUndoRedo(previousState); } @@ -1123,8 +1125,10 @@ void QTextDocument::setHtml(const QString &html) Q_D(QTextDocument); bool previousState = d->isUndoRedoEnabled(); d->enableUndoRedo(false); + d->beginEditBlock(); d->clear(); QTextHtmlImporter(this, html, QTextHtmlImporter::ImportToDocument).import(); + d->endEditBlock(); d->enableUndoRedo(previousState); } |