}
}
- if (interactionFlags & Qt::TextEditable) {
+ if (cursor.position() != oldCursorPos) {
q->updateCursorRectangle(true);
- if (cursor.position() != oldCursorPos)
- emit q->cursorPositionChanged();
+ emit q->cursorPositionChanged();
+ }
+ if (interactionFlags & Qt::TextEditable)
_q_updateCurrentCharFormatAndSelection();
- } else {
- if (cursor.position() != oldCursorPos) {
- emit q->cursorPositionChanged();
- q->updateCursorRectangle(true);
- }
+ else
selectionChanged();
- }
repaintOldAndNewSelection(oldSelection);
hadSelectionOnMousePress = cursor.hasSelection();
}
const QRectF &oldGeometry)
{
Q_D(QQuickTextEdit);
- if (newGeometry.width() != oldGeometry.width() && d->wrapMode != NoWrap && widthValid() && !d->inLayout) {
+ if (newGeometry.width() != oldGeometry.width() && widthValid() && !d->inLayout) {
updateSize();
moveCursorDelegate();
}
property string text: "اختبا"
Rectangle {
+ id: arabicContainer
anchors.centerIn: parent
width: 200
height: 20
textFormat: TextEdit.AutoText
}
}
+
+ Rectangle {
+ anchors.top: arabicContainer.bottom
+ anchors.left: arabicContainer.left
+ width: 200
+ height: 20
+ color: "green"
+
+ TextEdit {
+ id: emptyTextEdit
+ objectName: "emptyTextEdit"
+ anchors.fill: parent
+ textFormat: TextEdit.AutoText
+ }
+ }
}
textEdit->setHAlign(QQuickTextEdit::AlignRight);
QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight);
QVERIFY(textEdit->positionToRectangle(0).x() > canvas.width()/2);
+
+ // make sure editor doesn't rely on input for updating size
+ QQuickTextEdit *emptyEdit = canvas.rootObject()->findChild<QQuickTextEdit*>("emptyTextEdit");
+ QVERIFY(emptyEdit != 0);
+ platformInputContext.setInputDirection(Qt::RightToLeft);
+ emptyEdit->setFocus(true);
+ QCOMPARE(emptyEdit->hAlign(), QQuickTextEdit::AlignRight);
+ QVERIFY(emptyEdit->cursorRectangle().left() > canvas.width()/2);
}
void tst_qquicktextedit::vAlign()