diff options
author | Jere Tuliniemi <jere.tuliniemi@qt.io> | 2022-08-25 10:00:24 +0300 |
---|---|---|
committer | Jere Tuliniemi <jere.tuliniemi@qt.io> | 2022-10-06 16:32:10 +0300 |
commit | 2f46f072f0ed93e95293c404e5efcb713df1e847 (patch) | |
tree | 1e4a915ab5de0598a05420c70e8b2a344d31be61 /src/quick | |
parent | 86a45ca998c5a20e31050b52789877abf3414fc2 (diff) |
Clear delivery agent delegated focus
When focus was delegated, the focused item would remain as an active
focus item in the delivery agent after deletion. Further use by the
delivery agent would then cause a crash. But since
543598a6cc07d67e7651c9f65c058465ea6d8425 the intention is that the
window's DA's activeFocusItem is the one that counts (if there is only
one keyboard, there can be only one place to type text; and incoming
events will visit the window's DA first.) So any time we clear focus,
the window's DA has to clear it, just as setFocusInScope() delegates to
the window's DA.
Fixes: QTBUG-105192
Change-Id: Iec8c6c67ff18b5dac5ec13fcced6e3fe30423c14
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit de0a6cc47131671963c2ce45ee80c02195d92dbd)
(cherry picked from commit ffd1b09cbf0e7a4e611e92e04398fcb374ef4e81)
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/util/qquickdeliveryagent.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/quick/util/qquickdeliveryagent.cpp b/src/quick/util/qquickdeliveryagent.cpp index 19758382d7..f654b6adda 100644 --- a/src/quick/util/qquickdeliveryagent.cpp +++ b/src/quick/util/qquickdeliveryagent.cpp @@ -560,7 +560,11 @@ void QQuickDeliveryAgentPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem if (!changed.isEmpty()) notifyFocusChangesRecur(changed.data(), changed.count() - 1, reason); - + if (isSubsceneAgent) { + auto da = QQuickWindowPrivate::get(rootItem->window())->deliveryAgent; + qCDebug(lcFocus) << " delegating clearFocusInScope to" << da; + QQuickWindowPrivate::get(rootItem->window())->deliveryAgentPrivate()->clearFocusInScope(da->rootItem(), item, reason, options); + } if (oldActiveFocusItem == activeFocusItem) qCDebug(lcFocus) << "activeFocusItem remains" << activeFocusItem << "in" << q; else |