From 7c6e4af4832658d0beede9adc77954222898cb3b Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 4 Nov 2021 11:03:17 +0100 Subject: [PATCH] QWidget: always handle IM queries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A widget (e.g QLineEdit) will set WA_InputMethodEnabled to false if it's read-only. But it can still contain selected text (e.g from a mouse drag). In many cases, it therefore makes sense to be able to query the focus object for what that selection is, e.g to be able to show selection handles from the QPA plugin (iOS/Android). Therefore, remove the check if a widget has WA_InputMethodEnabled, and always process the query. The caller can always check this flag himself (or Qt::ImEnabled) before sending the query, if needed. Task-number: QTBUG-91545 Change-Id: Ia3dfa289283b5c157ba47cf0b508f9fddadd2861 Reviewed-by: Tor Arne Vestbø --- src/widgets/kernel/qwidget.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 283c6b00a1..7c48df9799 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -8891,8 +8891,7 @@ bool QWidget::event(QEvent *event) inputMethodEvent((QInputMethodEvent *) event); break; - case QEvent::InputMethodQuery: - if (testAttribute(Qt::WA_InputMethodEnabled)) { + case QEvent::InputMethodQuery: { QInputMethodQueryEvent *query = static_cast(event); Qt::InputMethodQueries queries = query->queries(); for (uint i = 0; i < 32; ++i) {