diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2009-07-09 05:05:28 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2009-07-09 05:05:28 (GMT) |
commit | 7343bbb230161d563b0226011e4519f695fdc593 (patch) | |
tree | 321f54514ab84ce308123be365f446e77d6d6f7e /src/declarative/fx/qfxtextedit.cpp | |
parent | 25b603c4dcbe5452f37fec17afe26e8689bc618c (diff) | |
download | Qt-7343bbb230161d563b0226011e4519f695fdc593.zip Qt-7343bbb230161d563b0226011e4519f695fdc593.tar.gz Qt-7343bbb230161d563b0226011e4519f695fdc593.tar.bz2 |
Tests for QFxTextEdit selection properties
Also fixes some bugs that the tests uncovered.
Also fixes the test, which was using a now invalid QmlComponent
Constructor.
Diffstat (limited to 'src/declarative/fx/qfxtextedit.cpp')
-rw-r--r-- | src/declarative/fx/qfxtextedit.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index caa48cf..87a27d9 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -481,6 +481,7 @@ void QFxTextEdit::setCursorPosition(int pos) if (cursor.position() == pos) return; cursor.setPosition(pos); + d->control->setTextCursor(cursor); } /*! @@ -1047,6 +1048,7 @@ void QFxTextEditPrivate::init() QObject::connect(control, SIGNAL(textChanged()), q, SLOT(q_textChanged())); QObject::connect(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged())); QObject::connect(control, SIGNAL(selectionChanged()), q, SLOT(updateSelectionMarkers())); + QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(updateSelectionMarkers())); QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged())); document = control->document(); @@ -1081,8 +1083,10 @@ void QFxTextEditPrivate::updateSelection() bool startChange = (lastSelectionStart != cursor.selectionStart()); bool endChange = (lastSelectionEnd != cursor.selectionEnd()); //### Is it worth calculating a more minimal set of movements? + cursor.beginEditBlock(); cursor.setPosition(lastSelectionStart, QTextCursor::MoveAnchor); cursor.setPosition(lastSelectionEnd, QTextCursor::KeepAnchor); + cursor.endEditBlock(); control->setTextCursor(cursor); if(startChange) q->selectionStartChanged(); |