diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-03-10 14:37:15 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-03-20 08:20:00 +0100 |
commit | e7cff5bca7aefaea63e80598babf6bd7917aa1c3 (patch) | |
tree | c7a1c3ac3b7c65b5665231774d0da67500773c13 /src/widgets | |
parent | 40f4b3de1a7dc8fdce26893880f2d4ca962cf966 (diff) |
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 <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/widgets/qabstractbutton.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
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<QAbstractButton *> buttonList = queryButtonList();; + QList<QAbstractButton *> 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(); |