summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-12-07 10:58:01 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-12-07 10:58:01 (GMT)
commit0a4f8a73165da5ec274409dffa1de921421d9bb1 (patch)
treea9209a8d091da93155c6b01e1ecd093838ec72c6
parent47008b211fe3b972077466e593a2a9016446bab2 (diff)
parent599ffaef76eb92af2bbce6e5baff539958bfdd14 (diff)
downloadQt-0a4f8a73165da5ec274409dffa1de921421d9bb1.zip
Qt-0a4f8a73165da5ec274409dffa1de921421d9bb1.tar.gz
Qt-0a4f8a73165da5ec274409dffa1de921421d9bb1.tar.bz2
Merge remote branch 'staging/4.6' into 4.6
-rw-r--r--doc/doc.pri5
-rw-r--r--examples/widgets/stylesheet/mainwindow.ui2
-rw-r--r--src/gui/text/qtextdocument_p.cpp12
-rw-r--r--tests/auto/qtextcursor/tst_qtextcursor.cpp28
-rw-r--r--tools/qdoc3/documentation.pri5
-rw-r--r--tools/qdoc3/qdoc3.pro2
-rw-r--r--tools/tools.pro2
7 files changed, 43 insertions, 13 deletions
diff --git a/doc/doc.pri b/doc/doc.pri
index d4fdcd8..463c447 100644
--- a/doc/doc.pri
+++ b/doc/doc.pri
@@ -34,12 +34,9 @@ win32-g++:isEmpty(QMAKE_SH) {
QT_DOCUMENTATION = $$replace(QT_DOCUMENTATION, "/", "\\\\")
}
-
-!wince*:!cross_compile:SUBDIRS += tools/qdoc3
-
# Build rules:
adp_docs.commands = ($$QDOC $$ADP_DOCS_QDOCCONF_FILE)
-adp_docs.depends += sub-tools-qdoc3
+adp_docs.depends += sub-tools # qdoc3
qch_docs.commands = $$QT_DOCUMENTATION
qch_docs.depends += sub-tools
diff --git a/examples/widgets/stylesheet/mainwindow.ui b/examples/widgets/stylesheet/mainwindow.ui
index 740d37b..2b232df 100644
--- a/examples/widgets/stylesheet/mainwindow.ui
+++ b/examples/widgets/stylesheet/mainwindow.ui
@@ -41,7 +41,7 @@
<string>Please read the LICENSE file before checking</string>
</property>
<property name="text" >
- <string>I &amp;accept the terms and &amp;conditions</string>
+ <string>I accept the terms and &amp;conditions</string>
</property>
</widget>
</item>
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index 18e1ffc..b015198 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -870,6 +870,7 @@ int QTextDocumentPrivate::undoRedo(bool undo)
undoEnabled = false;
beginEditBlock();
+ int editPos = -1;
while (1) {
if (undo)
--undoState;
@@ -881,11 +882,13 @@ int QTextDocumentPrivate::undoRedo(bool undo)
remove(c.pos, c.length, (QTextUndoCommand::Operation)c.operation);
PMDEBUG(" erase: from %d, length %d", c.pos, c.length);
c.command = QTextUndoCommand::Removed;
+ editPos = c.pos;
break;
case QTextUndoCommand::Removed:
PMDEBUG(" insert: format %d (from %d, length %d, strpos=%d)", c.format, c.pos, c.length, c.strPos);
insert_string(c.pos, c.strPos, c.length, c.format, (QTextUndoCommand::Operation)c.operation);
c.command = QTextUndoCommand::Inserted;
+ editPos = c.pos + c.length;
break;
case QTextUndoCommand::BlockInserted:
case QTextUndoCommand::BlockAdded:
@@ -895,6 +898,7 @@ int QTextDocumentPrivate::undoRedo(bool undo)
c.command = QTextUndoCommand::BlockRemoved;
else
c.command = QTextUndoCommand::BlockDeleted;
+ editPos = c.pos;
break;
case QTextUndoCommand::BlockRemoved:
case QTextUndoCommand::BlockDeleted:
@@ -905,6 +909,7 @@ int QTextDocumentPrivate::undoRedo(bool undo)
c.command = QTextUndoCommand::BlockInserted;
else
c.command = QTextUndoCommand::BlockAdded;
+ editPos = c.pos + 1;
break;
case QTextUndoCommand::CharFormatChanged: {
resetBlockRevision = -1; // ## TODO
@@ -915,6 +920,7 @@ int QTextDocumentPrivate::undoRedo(bool undo)
int oldFormat = it.value()->format;
setCharFormat(c.pos, c.length, formats.charFormat(c.format));
c.format = oldFormat;
+ editPos = c.pos + c.length;
break;
}
case QTextUndoCommand::BlockFormatChanged: {
@@ -937,6 +943,7 @@ int QTextDocumentPrivate::undoRedo(bool undo)
group->blockFormatChanged(it);
}
documentChange(it.position(), it.length());
+ editPos = -1;
break;
}
case QTextUndoCommand::GroupFormatChange: {
@@ -946,6 +953,7 @@ int QTextDocumentPrivate::undoRedo(bool undo)
int oldFormat = formats.objectFormatIndex(c.objectIndex);
changeObjectFormat(object, c.format);
c.format = oldFormat;
+ editPos = -1;
break;
}
case QTextUndoCommand::Custom:
@@ -954,6 +962,7 @@ int QTextDocumentPrivate::undoRedo(bool undo)
c.custom->undo();
else
c.custom->redo();
+ editPos = -1;
break;
default:
Q_ASSERT(false);
@@ -979,8 +988,7 @@ int QTextDocumentPrivate::undoRedo(bool undo)
break;
}
undoEnabled = true;
- int editPos = -1;
- if (docChangeFrom >= 0) {
+ if (editPos < 0 && docChangeFrom >= 0) {
editPos = qMin(docChangeFrom + docChangeLength, length() - 1);
}
endEditBlock();
diff --git a/tests/auto/qtextcursor/tst_qtextcursor.cpp b/tests/auto/qtextcursor/tst_qtextcursor.cpp
index d910c8d..d0c2afd 100644
--- a/tests/auto/qtextcursor/tst_qtextcursor.cpp
+++ b/tests/auto/qtextcursor/tst_qtextcursor.cpp
@@ -149,6 +149,8 @@ private slots:
void adjustCursorsOnInsert();
+ void cursorPositionWithBlockUndoAndRedo();
+
private:
int blockCount();
@@ -1747,9 +1749,33 @@ void tst_QTextCursor::adjustCursorsOnInsert()
QCOMPARE(selection.anchor(), posAfter);
doc->undo();
+}
+void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo()
+{
+ cursor.insertText("AAAABBBBCCCCDDDD");
+ cursor.beginEditBlock();
+ cursor.setPosition(12);
+ int cursorPositionBefore = cursor.position();
+ cursor.insertText("*");
+ cursor.setPosition(8);
+ cursor.insertText("*");
+ cursor.setPosition(4);
+ cursor.insertText("*");
+ cursor.setPosition(0);
+ cursor.insertText("*");
+ int cursorPositionAfter = cursor.position();
+ cursor.endEditBlock();
+ QVERIFY(doc->toPlainText() == "*AAAA*BBBB*CCCC*DDDD");
+ QCOMPARE(12, cursorPositionBefore);
+ QCOMPARE(1, cursorPositionAfter);
-
+ doc->undo(&cursor);
+ QVERIFY(doc->toPlainText() == "AAAABBBBCCCCDDDD");
+ QCOMPARE(cursor.position(), cursorPositionBefore);
+ doc->redo(&cursor);
+ QVERIFY(doc->toPlainText() == "*AAAA*BBBB*CCCC*DDDD");
+ QCOMPARE(cursor.position(), cursorPositionAfter);
}
QTEST_MAIN(tst_QTextCursor)
diff --git a/tools/qdoc3/documentation.pri b/tools/qdoc3/documentation.pri
deleted file mode 100644
index d952183..0000000
--- a/tools/qdoc3/documentation.pri
+++ /dev/null
@@ -1,5 +0,0 @@
-# NOTE: THIS FILE IS SHARED BY qdoc3.pro AND projects.pro
-#
-# So while changing this file, please make sure to that your changes
-# work in root qt soure dir with (n)make docs and for building with qdoc
-#
diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro
index bacef3f..441bf39 100644
--- a/tools/qdoc3/qdoc3.pro
+++ b/tools/qdoc3/qdoc3.pro
@@ -105,3 +105,5 @@ SOURCES += apigenerator.cpp \
webxmlgenerator.cpp \
yyindent.cpp
+target.path = $$[QT_INSTALL_BINS]
+INSTALLS += target
diff --git a/tools/tools.pro b/tools/tools.pro
index 87ba3c9..4cff507 100644
--- a/tools/tools.pro
+++ b/tools/tools.pro
@@ -31,5 +31,7 @@ contains(QT_CONFIG, dbus):SUBDIRS += qdbus
!wince*:contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns xmlpatternsvalidator
embedded: SUBDIRS += makeqpf
+!wince*:!cross_compile:SUBDIRS += qdoc3
+
CONFIG+=ordered
QTDIR_build:REQUIRES = "contains(QT_CONFIG, full-config)"