From d4ddd6bcca25122f379477bf5e6322f05dae903f Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Tue, 9 Nov 2021 18:02:49 +0300 Subject: Skip disabled proxy widgets when (back)tabbing Fixes: QTBUG-98137 Change-Id: If52053dce361b130ef7dcfaf747710d8ceb9bbcd Reviewed-by: Volker Hilsheimer (cherry picked from commit 185c8d5adf563e19d8a969382663a988a7173614) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/kernel/qapplication.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/widgets/kernel/qapplication.cpp') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 1302e3014e..0fe6827e9c 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2135,7 +2135,10 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool // \a next). This is to ensure that we can tab in and out of compound widgets // without getting stuck in a tab-loop between parent and child. QWidget *focusProxy = test->d_func()->deepestFocusProxy(); - const bool canTakeFocus = ((focusProxy ? focusProxy->focusPolicy() : test->focusPolicy()) + auto effectiveFocusPolicy = [](QWidget *widget) { + return widget->isEnabled() ? widget->focusPolicy() : Qt::NoFocus; + }; + const bool canTakeFocus = (effectiveFocusPolicy(focusProxy ? focusProxy : test) & focus_flag) == focus_flag; const bool composites = focusProxy ? (next ? focusProxy->isAncestorOf(test) : test->isAncestorOf(focusProxy)) -- cgit v1.2.1