More icon updates on theme change

(cherry picked from commit 0ac6e6acbe)
This commit is contained in:
Haoyu Qiu 2022-03-15 23:05:12 +08:00 committed by Rémi Verschelde
parent 8db39b82ea
commit 8eb539d5c1
3 changed files with 22 additions and 15 deletions

View file

@ -425,9 +425,12 @@ void EditorProfiler::_clear_pressed() {
} }
void EditorProfiler::_notification(int p_what) { void EditorProfiler::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) { switch (p_what) {
activate->set_icon(get_icon("Play", "EditorIcons")); case NOTIFICATION_ENTER_TREE:
clear_button->set_icon(get_icon("Clear", "EditorIcons")); case NOTIFICATION_THEME_CHANGED: {
activate->set_icon(get_icon("Play", "EditorIcons"));
clear_button->set_icon(get_icon("Clear", "EditorIcons"));
} break;
} }
} }

View file

@ -39,15 +39,11 @@ void ResourcePreloaderEditor::_gui_input(Ref<InputEvent> p_event) {
} }
void ResourcePreloaderEditor::_notification(int p_what) { void ResourcePreloaderEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) { switch (p_what) {
load->set_icon(get_icon("Folder", "EditorIcons")); case NOTIFICATION_ENTER_TREE:
} case NOTIFICATION_THEME_CHANGED: {
load->set_icon(get_icon("Folder", "EditorIcons"));
if (p_what == NOTIFICATION_READY) { } break;
//NodePath("/root")->connect("node_removed", this,"_node_removed",Vector<Variant>(),true);
}
if (p_what == NOTIFICATION_DRAW) {
} }
} }

View file

@ -349,8 +349,16 @@ void ShaderEditor::_menu_option(int p_option) {
} }
void ShaderEditor::_notification(int p_what) { void ShaderEditor::_notification(int p_what) {
if (p_what == MainLoop::NOTIFICATION_WM_FOCUS_IN) { switch (p_what) {
_check_for_external_edit(); case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
PopupMenu *popup = help_menu->get_popup();
popup->set_item_icon(popup->get_item_index(HELP_DOCS), get_icon("Instance", "EditorIcons"));
} break;
case MainLoop::NOTIFICATION_WM_FOCUS_IN: {
_check_for_external_edit();
} break;
} }
} }
@ -664,7 +672,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
help_menu = memnew(MenuButton); help_menu = memnew(MenuButton);
help_menu->set_text(TTR("Help")); help_menu->set_text(TTR("Help"));
help_menu->set_switch_on_hover(true); help_menu->set_switch_on_hover(true);
help_menu->get_popup()->add_icon_item(p_node->get_gui_base()->get_icon("Instance", "EditorIcons"), TTR("Online Docs"), HELP_DOCS); help_menu->get_popup()->add_item(TTR("Online Docs"), HELP_DOCS);
help_menu->get_popup()->connect("id_pressed", this, "_menu_option"); help_menu->get_popup()->connect("id_pressed", this, "_menu_option");
add_child(main_container); add_child(main_container);