Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.15.5, 6.2
-
None
-
e08f6d601de4faea869dcfd05a7e133366328981 (qt/qtbase/dev) 045804c45d886af6b8d9ffba50608384c5a10d20 (qt/qtbase/6.2)
Description
QLineEdit tests after each key press event accepted by the control whether the layout direction of the text document has changed, and changes its own layout direction if so:
// QLineEdit::keyPressEvent d->control->processKeyEvent(event); if (event->isAccepted()) { if (layoutDirection() != d->control->layoutDirection()) setLayoutDirection(d->control->layoutDirection()); d->control->updateCursorBlinking(); } }
QLineEdit is the only widget that does that, and it does so only for key presses. It doesn't apply that logic for programmatic changes to the text, which results in an inconsistent user experience. If the QLineEdit is initialized with RTL text but without explicitly setting the layout direction, then the widget's layout direction is still Qt::LeftToRight; but the first accepted key press (cursor navigation, or appending any latin1 character) will change the layout direction to Qt::RightToLeft. Selecting all text and cutting it out via keyboard shortcuts (Ctrl+A;Ctrl+X) will change the layout direction back to LTR, but using the context menu event actions to do the same will not.
QTextEdit does not apply any such logic, i.e. typing in an RTL language does not flip the vertical scrollbar to the left.
This logic seems broken, and should be removed from QLineEdit as well.
Attachments
Issue Links
- relates to
-
QTBUG-94824 In qlinedit, icon and text overlap
-
- Closed
-
For Gerrit Dashboard: QTBUG-95011 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
358558,3 | QLineEdit: don't change layout direction on keyboard input | dev | qt/qtbase | Status: MERGED | +2 | 0 |
359613,2 | QLineEdit: don't change layout direction on keyboard input | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 |