diff options
author | mae <qt-info@nokia.com> | 2009-09-24 10:31:51 (GMT) |
---|---|---|
committer | mae <qt-info@nokia.com> | 2009-09-24 10:33:20 (GMT) |
commit | 06aa9b6704637864130e318e8700f1b0b4f8a5e3 (patch) | |
tree | f2140e2d31b62570bcd278a088670bbc9cf87234 /src/gui/text/qtextdocument_p.h | |
parent | 135e02d11becc8ee434524756d85221244c185ee (diff) | |
download | Qt-06aa9b6704637864130e318e8700f1b0b4f8a5e3.zip Qt-06aa9b6704637864130e318e8700f1b0b4f8a5e3.tar.gz Qt-06aa9b6704637864130e318e8700f1b0b4f8a5e3.tar.bz2 |
Fix QTextDocument::revision()
The revision was bound to the current depth of the undo stack. This
had the negative side effect, that equal revisions could point to
different documents, and sometimes changes would not even increase
the revision (in the case of undo command merging).
Reviewed-by: Roberto Raggi
Diffstat (limited to 'src/gui/text/qtextdocument_p.h')
-rw-r--r-- | src/gui/text/qtextdocument_p.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h index 36f3241..ce25c57 100644 --- a/src/gui/text/qtextdocument_p.h +++ b/src/gui/text/qtextdocument_p.h @@ -201,10 +201,9 @@ public: inline void undo() { undoRedo(true); } inline void redo() { undoRedo(false); } void appendUndoItem(QAbstractUndoItem *); - inline void beginEditBlock() { editBlock++; } + inline void beginEditBlock() { if (0 == editBlock++) ++revision; } void joinPreviousEditBlock(); void endEditBlock(); - inline void beginEdit() { inEdit = true; } void finishEdit(); inline bool isInEditBlock() const { return editBlock; } void enableUndoRedo(bool enable); @@ -306,6 +305,7 @@ private: QVector<QTextUndoCommand> undoStack; bool undoEnabled; int undoState; + int revision; // position in undo stack of the last setModified(false) call int modifiedState; bool modified; @@ -340,7 +340,6 @@ public: int maximumBlockCount; uint needsEnsureMaximumBlockCount : 1; uint inContentsChange : 1; - uint inEdit : 1; // between beginEdit() and finishEdit() QSizeF pageSize; QString title; QString url; |