Outside of when of a monospace font is used, if the text changes the
visual position of the cursor will have most likely changed as well
even when the cursor index hasn't.
Task-number: QTBUG-28677
Change-Id: If8077772d8541a677d5875976e6cd9fc453731df
Reviewed-by: Alan Alpert <aalpert@rim.com>
bool inputMethodAttributesChanged = m_textDirty || m_selDirty;
#endif
bool alignmentChanged = false;
+ bool textChanged = false;
if (m_textDirty) {
// do validation
}
if (m_textDirty) {
+ textChanged = true;
m_textDirty = false;
#ifndef QT_NO_IM
m_preeditDirty = false;
#endif
emitUndoRedoChanged();
- if (!emitCursorPositionChanged() && alignmentChanged)
+ if (!emitCursorPositionChanged() && (alignmentChanged || textChanged))
q->updateCursorRectangle();
return true;
input.setHAlign(leftToRight ? QQuickTextInput::AlignRight : QQuickTextInput::AlignLeft);
r = input.cursorRectangle();
QCOMPARE(r.left(), leftToRight ? input.width() : 0);
+
+ QSignalSpy cursorRectangleSpy(&input, SIGNAL(cursorRectangleChanged()));
+
+ QString widerText = shortText;
+ widerText[1] = 'W'; // Assumes shortText is at least two characters long.
+ input.setText(widerText);
+
+ QCOMPARE(cursorRectangleSpy.count(), 1);
}
void tst_qquicktextinput::readOnly()