QLineEdit: always process an input method event

If a line edit is read-only, it only means that the _user_
should not be able to change the text. Qt itself (or the
application, by e.g calling setText()) should not have
this restriction.

For the QPA plugins to be able adjust the current selection from
selection handles, we should always process input method events.
It's the callers responsibility to ensure that the focus object
supports the actions it sends to the focus object (like ImReadOnly,
or ImhNoPredictiveText), and not QLineEdit.

This patch will therefore remove the check for
shouldEnableInputMethod() before processing the event. This will
allow us to adjust the selection from the QPA plugin (iOS/Android).

Task-number: QTBUG-91545
Change-Id: Id664ac3605a3fa0bf207635ed31d24c045d29a07
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Richard Moe Gustavsen 2021-11-04 11:11:39 +01:00
parent 7c6e4af483
commit 7d90bee769

View File

@ -1805,10 +1805,6 @@ QRect QLineEdit::cursorRect() const
void QLineEdit::inputMethodEvent(QInputMethodEvent *e)
{
Q_D(QLineEdit);
if (!d->shouldEnableInputMethod()) {
e->ignore();
return;
}
if (echoMode() == PasswordEchoOnEdit && !d->control->passwordEchoEditing()) {
// Clear the edit and reset to normal echo mode while entering input