summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2021-07-07 09:56:17 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2021-07-13 19:01:55 +0200
commite08f6d601de4faea869dcfd05a7e133366328981 (patch)
treed2f361ee7559116433ec94d16fd639ed99433bec /src/widgets/widgets
parent66e5dbfc0d2dc7096bb4c9eabde870f4dded94be (diff)
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 <fanruijie@uniontech.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r--src/widgets/widgets/qlineedit.cpp5
1 files changed, 1 insertions, 4 deletions
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();
- }
}
/*!