summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-06-12 22:46:12 +0200
committerGitHub <noreply@github.com>2019-06-12 22:46:12 +0200
commit2dc3347ce9fd895448e3ddd5253e48e0c1bd98dc (patch)
tree0eac851bab57ea930ae7c8a0f6aa2a7a06dee051 /scene/gui
parentd1a88cb8955a88e810e783e239378cedfc314555 (diff)
parent2cedf7173a104a1b17af38b9c663a339c5fa664d (diff)
Merge pull request #29717 from akien-mga/button-shortcut-pressed
BaseButton: Make shortcuts call virtual methods
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/base_button.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 5ef2557383..fadf5e432c 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -216,9 +216,7 @@ void BaseButton::set_pressed(bool p_pressed) {
if (p_pressed) {
_unpress_group();
}
- if (toggle_mode) {
- _toggled(status.pressed);
- }
+ _toggled(status.pressed);
update();
}
@@ -337,9 +335,6 @@ bool BaseButton::is_keep_pressed_outside() const {
void BaseButton::set_shortcut(const Ref<ShortCut> &p_shortcut) {
- if (shortcut.is_null() == p_shortcut.is_null())
- return;
-
shortcut = p_shortcut;
set_process_unhandled_input(shortcut.is_valid());
}
@@ -356,11 +351,10 @@ void BaseButton::_unhandled_input(Ref<InputEvent> p_event) {
return; //ignore because of modal window
if (is_toggle_mode()) {
- set_pressed(!is_pressed());
- emit_signal("toggled", is_pressed());
+ set_pressed(!is_pressed()); // Also calls _toggled() internally.
}
- emit_signal("pressed");
+ _pressed();
}
}