Scroll correctly when cursorPosition is changed within onTextChanged.
authorAndrew den Exter <andrew.den-exter@nokia.com>
Mon, 25 Jul 2011 03:17:35 +0000 (13:17 +1000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 25 Jul 2011 06:15:47 +0000 (08:15 +0200)
Emit textChanged() before adjusting size and scroll positions otherwise
the calculations will be based on the cursor position before it's moved
in handler and because the cursor position won't ultimately have changed
there won't be a follow up cursorPositionChanged() signal to trigger a
second set of calculation.

Task-number: QTBUG-19912
Reviewed-by: Martin Jones
(cherry picked from commit bb11b53bedb8e239b9439b4a3fc3320e35c2de57)

Conflicts:

src/declarative/graphicsitems/qdeclarativetextinput.cpp

Change-Id: I579bc3fe6c80766dfadfbc9dbd46144607bf7b03
Reviewed-on: http://codereview.qt.nokia.com/2058
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
src/declarative/items/qsgtextinput.cpp
src/qtquick1/graphicsitems/qdeclarativetextinput.cpp

index a150b7e..e73237e 100644 (file)
@@ -1219,12 +1219,12 @@ void QSGTextInput::selectionChanged()
 void QSGTextInput::q_textChanged()
 {
     Q_D(QSGTextInput);
+    emit textChanged();
+    emit displayTextChanged();
     updateSize();
     d->determineHorizontalAlignment();
     d->updateHorizontalScroll();
     updateMicroFocus();
-    emit textChanged();
-    emit displayTextChanged();
     if(hasAcceptableInput() != d->oldValidity){
         d->oldValidity = hasAcceptableInput();
         emit acceptableInputChanged();
index 582e3c7..9a291ea 100644 (file)
@@ -1948,12 +1948,12 @@ void QDeclarative1TextInput::selectionChanged()
 void QDeclarative1TextInput::q_textChanged()
 {
     Q_D(QDeclarative1TextInput);
+    emit textChanged();
+    emit displayTextChanged();
     updateSize();
     d->determineHorizontalAlignment();
     d->updateHorizontalScroll();
     updateMicroFocus();
-    emit textChanged();
-    emit displayTextChanged();
     if(hasAcceptableInput() != d->oldValidity){
         d->oldValidity = hasAcceptableInput();
         emit acceptableInputChanged();