diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2024-04-08 17:46:01 +0200 |
---|---|---|
committer | Ivan Solovev <ivan.solovev@qt.io> | 2024-04-11 17:18:51 +0200 |
commit | 9d8c749854bff84046fa2c3c7f7d7039609facc1 (patch) | |
tree | 36927bbe37878aceb2053886d9c2a008dc6c5240 /src/quick | |
parent | 12486c4b0d532b1d3f6717b64d6eed01ed720948 (diff) |
Android: fix handling of InputMethodQuery
Somewhere between Qt 6.5.1 and dev (backported to 6.5.4) something has
changed the behavior of QQuickItem::nextItemInFocusChain() or
QQuickItem::activeFocusOnTab(). I could not figure out the patch to
blame, because the actual code of these methods didn't change, but
as a result the loop to determine the next focus item in
QQuickTextInput::inputMethodQuery() was running forever.
Fix it by explicitly checking if the element changes between the loop
iterations, and if it does not, simply assing nullptr to it, acting as
if no focus item was found in the chain.
Fixes: QTBUG-123378
Pick-to: 6.7 6.5
Change-Id: I987f8ef2548cc116c2e69f5175d4af0bdb3ab3d0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 0acb4b38dc..3edfb6aa1b 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -2045,8 +2045,14 @@ QVariant QQuickTextInput::inputMethodQuery(Qt::InputMethodQuery property) const || d->extra->enterKeyAttached->type() == Qt::EnterKeyDefault) { QQuickItem *next = const_cast<QQuickTextInput*>(this)->nextItemInFocusChain(); - while (next && next != this && !next->activeFocusOnTab()) + QQuickItem *originalNext = next; + while (next && next != this && !next->activeFocusOnTab()) { next = next->nextItemInFocusChain(); + if (next == originalNext) { + // There seems to be no suitable element in the focus chain + next = nullptr; + } + } if (next) { const auto nextYPos = next->mapToGlobal(QPoint(0, 0)).y(); const auto currentYPos = this->mapToGlobal(QPoint(0, 0)).y(); |