From bb11b53bedb8e239b9439b4a3fc3320e35c2de57 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 20 Jun 2011 12:18:57 +1000 Subject: Scroll correctly when cursorPosition is changed within onTextChanged. 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. Change-Id: I1af7cf320baf984388d90562233c5686dcf44d20 Task-number: QTBUG-19912 Reviewed-by: Martin Jones --- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 0d10bb6..21e3ad3 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1940,12 +1940,12 @@ void QDeclarativeTextInput::selectionChanged() void QDeclarativeTextInput::q_textChanged() { Q_D(QDeclarativeTextInput); + emit textChanged(); + emit displayTextChanged(); updateSize(); d->determineHorizontalAlignment(); d->updateHorizontalScroll(); updateMicroFocus(); - emit textChanged(); - emit displayTextChanged(); if(hasAcceptableInput() != d->oldValidity){ d->oldValidity = hasAcceptableInput(); emit acceptableInputChanged(); -- cgit v0.12