From 390aa2a565ec39a742385b5f8c967bc7f50264fe Mon Sep 17 00:00:00 2001 From: Markus Sauermann <6299227+Sauermann@users.noreply.github.com> Date: Fri, 16 Jun 2023 00:15:37 +0200 Subject: [PATCH] Fix ButtonGroup unpressing It was possible to unpress a button group that had `allow_unpress = false` using shortcuts. Adjust `BaseButton::shortcut_input` to use the same logic as `BaseButton::on_action_event`. --- scene/gui/base_button.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index e5b77654cf0..3ac3ca7363e 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -366,11 +366,9 @@ void BaseButton::shortcut_input(const Ref &p_event) { if (toggle_mode) { status.pressed = !status.pressed; - if (status.pressed) { - _unpress_group(); - if (button_group.is_valid()) { - button_group->emit_signal(SNAME("pressed"), this); - } + _unpress_group(); + if (button_group.is_valid()) { + button_group->emit_signal(SNAME("pressed"), this); } _toggled(status.pressed);