summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextdocument_p.h
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2009-09-24 10:31:51 (GMT)
committermae <qt-info@nokia.com>2009-09-24 10:33:20 (GMT)
commit06aa9b6704637864130e318e8700f1b0b4f8a5e3 (patch)
treef2140e2d31b62570bcd278a088670bbc9cf87234 /src/gui/text/qtextdocument_p.h
parent135e02d11becc8ee434524756d85221244c185ee (diff)
downloadQt-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.h5
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;