From 7d90bee769a26c2060fa73b3e9c06278b9c5e358 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 4 Nov 2021 11:11:39 +0100 Subject: [PATCH] QLineEdit: always process an input method event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- src/widgets/widgets/qlineedit.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 616e1ae4246..3135b4a53c3 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -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