From e7cff5bca7aefaea63e80598babf6bd7917aa1c3 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 10 Mar 2020 14:37:15 +0100 Subject: Fix keypad navigation within a button group for push buttons Keypad navigation within a group should work for auto-exclusive buttons, or for checkable buttons that are in a button group. Since the code already tests whether the button should be treated like an exclusive (which implies checkable) button, use the result of that test when finding the candidate button to move focus to, and not only when actually changing the checked button and the focus. Change-Id: I4dc41a90d51a8304483046252ceff0ebfe2a2e52 Fixes: QTBUG-27151 Done-with: david.faure@kdab.com Reviewed-by: Volker Hilsheimer --- src/widgets/widgets/qabstractbutton.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets/widgets/qabstractbutton.cpp') diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 7961d0a21b..badeec37ee 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -246,7 +246,7 @@ void QAbstractButtonPrivate::notifyChecked() void QAbstractButtonPrivate::moveFocus(int key) { - QList buttonList = queryButtonList();; + QList buttonList = queryButtonList(); #if QT_CONFIG(buttongroup) bool exclusive = group ? group->d_func()->exclusive : autoExclusive; #else @@ -266,7 +266,7 @@ void QAbstractButtonPrivate::moveFocus(int key) for (int i = 0; i < buttonList.count(); ++i) { QAbstractButton *button = buttonList.at(i); if (button != f && button->window() == f->window() && button->isEnabled() && !button->isHidden() && - (autoExclusive || (button->focusPolicy() & focus_flag) == focus_flag)) { + (exclusive || (button->focusPolicy() & focus_flag) == focus_flag)) { QRect buttonRect = button->rect().translated(button->mapToGlobal(QPoint(0,0))); QPoint p = buttonRect.center(); -- cgit v1.2.3