From e08f6d601de4faea869dcfd05a7e133366328981 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 7 Jul 2021 09:56:17 +0200 Subject: QLineEdit: don't change layout direction on keyboard input QLineEdit was the only widget in Qt that flips the widget's layout direction if a key press changes the document's layout direction. This resulted in inconsistent behavior: setting text to RTL content programmatically didn't set the widget's layout direction to RTL, but the first key press (even if just a cursor key or a latin1 character) did. Clearing the text with keyboard shortcuts changed the layout direction, doing the same using the clear button or context menu actions didn't. In addition, the automatic changing overrode whatever the UI developer set, or what Qt detected as the global layout direction based on the active translation. Remove the automatic flipping. [ChangeLog][QtWidgets][QLineEdit] QLineEdit used to change the layout direction on each key press, based on the text content. This feature resulted in an inconsistent and erratic user experience, and has been removed. Fixes: QTBUG-95011 Pick-to: 6.2 Change-Id: Ib653350d35e25ce431cca1abe9b45bdf33d035fe Reviewed-by: Fan RuiJie Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qlineedit.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/widgets/widgets') diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index ec18eae7c7..35569d6eeb 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -1774,11 +1774,8 @@ void QLineEdit::keyPressEvent(QKeyEvent *event) } #endif d->control->processKeyEvent(event); - if (event->isAccepted()) { - if (layoutDirection() != d->control->layoutDirection()) - setLayoutDirection(d->control->layoutDirection()); + if (event->isAccepted()) d->control->updateCursorBlinking(); - } } /*! -- cgit v1.2.3