From 500996b13b96d2868a7da78d782108c2996684ec Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 4 Dec 2009 11:14:37 +0100 Subject: Stylesheets example: Fix warning about multiple &-mnemonics. Reviewed-by: Olivier Goffart --- examples/widgets/stylesheet/mainwindow.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@ Please read the LICENSE file before checking - I &accept the terms and &conditions + I accept the terms and &conditions -- cgit v0.12 From 9c8a41a157cf9ffbb6d839d05c4502fef59e21c6 Mon Sep 17 00:00:00 2001 From: mae Date: Fri, 4 Dec 2009 13:57:44 +0100 Subject: Added auto test for the cursor position when doing block undo and redo Block changes in different selections happens quite frequently with Qt Creator, e.g. when renaming local variables. This test tests the desired cursor position behaviour: after an undo, the cursor should be where it was when the block operation started. After a redo, the cursor should be where it was after the block operation ended. --- tests/auto/qtextcursor/tst_qtextcursor.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) 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) -- cgit v0.12 From 3046bffe2feda63ed7719f8f0db9b576013720db Mon Sep 17 00:00:00 2001 From: mae Date: Fri, 4 Dec 2009 14:04:41 +0100 Subject: Fix cursor positiong after block undo and redo Block changes in different selections happens quite frequently with Qt Creator, e.g. when renaming local variables. The desired behaviour which the tst_QTextCursor::cursorPositionWIthBLockUndoAndRedo() tests, is like this: after an undo, the cursor should be where it was when the block operation started. After a redo, the cursor should be where it was after the block operation ended. Reviewed-by: Simon Hausmann --- src/gui/text/qtextdocument_p.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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(); -- cgit v0.12 From 72edf630344a8625a6dd848a8655e685c536e009 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 4 Dec 2009 14:12:00 +0100 Subject: remove dead file --- tools/qdoc3/documentation.pri | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 tools/qdoc3/documentation.pri 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 -# -- cgit v0.12 From 599ffaef76eb92af2bbce6e5baff539958bfdd14 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 4 Dec 2009 14:54:34 +0100 Subject: make qdoc3 a proper tools subtarget and install it needed for building qtmobility and qtcreator docs without magic. Reviewed-by: Daniel Molkentin --- doc/doc.pri | 5 +---- tools/qdoc3/qdoc3.pro | 2 ++ tools/tools.pro | 2 ++ 3 files changed, 5 insertions(+), 4 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/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)" -- cgit v0.12