1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-14 13:41:12 +00:00

Fix theme application in various editor dialogs

99% of the time we shouldn't rely on the signal, we
should use the notification instead. I left some comments
in places where I couldn't quickly improve the code.
This commit is contained in:
Yuri Sizov
2023-12-04 13:18:48 +01:00
parent d76c1d0e51
commit 01888ae7ab
12 changed files with 54 additions and 73 deletions

View File

@@ -129,8 +129,8 @@ void EditorCommandPalette::_update_command_search(const String &search_text) {
section->set_text(0, item_name);
section->set_selectable(0, false);
section->set_selectable(1, false);
section->set_custom_bg_color(0, search_options->get_theme_color(SNAME("prop_subsection"), EditorStringName(Editor)));
section->set_custom_bg_color(1, search_options->get_theme_color(SNAME("prop_subsection"), EditorStringName(Editor)));
section->set_custom_bg_color(0, get_theme_color(SNAME("prop_subsection"), EditorStringName(Editor)));
section->set_custom_bg_color(1, get_theme_color(SNAME("prop_subsection"), EditorStringName(Editor)));
sections[section_name] = section;
}
@@ -164,6 +164,10 @@ void EditorCommandPalette::_notification(int p_what) {
was_showed = true;
}
} break;
case NOTIFICATION_THEME_CHANGED: {
command_search_box->set_right_icon(get_editor_theme_icon(SNAME("Search")));
} break;
}
}
@@ -303,10 +307,6 @@ Ref<Shortcut> EditorCommandPalette::add_shortcut_command(const String &p_command
return p_shortcut;
}
void EditorCommandPalette::_theme_changed() {
command_search_box->set_right_icon(search_options->get_editor_theme_icon(SNAME("Search")));
}
void EditorCommandPalette::_save_history() const {
Dictionary command_history;
@@ -330,7 +330,6 @@ EditorCommandPalette::EditorCommandPalette() {
connect("confirmed", callable_mp(this, &EditorCommandPalette::_confirmed));
VBoxContainer *vbc = memnew(VBoxContainer);
vbc->connect("theme_changed", callable_mp(this, &EditorCommandPalette::_theme_changed));
add_child(vbc);
command_search_box = memnew(LineEdit);