Skip to content

Commit cb73046

Browse files
committed
Close toasts instantly when Close button is pressed
1 parent 0f5f3bc commit cb73046

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

editor/gui/editor_toaster.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ Control *EditorToaster::popup(Control *p_control, Severity p_severity, double p_
375375
if (p_time > 0.0) {
376376
Button *close_button = memnew(Button);
377377
close_button->set_flat(true);
378-
close_button->connect(SceneStringName(pressed), callable_mp(this, &EditorToaster::close).bind(panel));
378+
close_button->connect(SceneStringName(pressed), callable_mp(this, &EditorToaster::instant_close).bind(panel));
379379
hbox_container->add_child(close_button);
380380

381381
toast.close_button = close_button;
@@ -501,6 +501,11 @@ void EditorToaster::close(Control *p_control) {
501501
toasts[p_control].popped = false;
502502
}
503503

504+
void EditorToaster::instant_close(Control *p_control) {
505+
close(p_control);
506+
p_control->set_modulate(Color(1, 1, 1, 0));
507+
}
508+
504509
EditorToaster *EditorToaster::get_singleton() {
505510
return singleton;
506511
}

editor/gui/editor_toaster.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ class EditorToaster : public HBoxContainer {
115115
Control *popup(Control *p_control, Severity p_severity = SEVERITY_INFO, double p_time = 0.0, const String &p_tooltip = String());
116116
void popup_str(const String &p_message, Severity p_severity = SEVERITY_INFO, const String &p_tooltip = String());
117117
void close(Control *p_control);
118+
void instant_close(Control *p_control);
118119

119120
EditorToaster();
120121
~EditorToaster();

0 commit comments

Comments
 (0)