diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-12-21 18:31:05 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-12-21 18:31:05 +0100 |
commit | f1b23e8c3958d9e7d18c03ca9fea935eae70ea7e (patch) | |
tree | 491ce2fc04e29634535f337bb9b645bd6d34cae4 | |
parent | 186f6f0d874e830cc4597710eb0bab12a20bca20 (diff) | |
parent | dff9c5e6017b4a56808aee7c6dcc7ec344748870 (diff) |
Merge pull request #70410 from Maran23/4-x-search-result-theme-update
Rebuild search result tree when the theme is changed
-rw-r--r-- | editor/find_in_files.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index b7e7200b11..3a6c891142 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -569,8 +569,6 @@ FindInFilesPanel::FindInFilesPanel() { hbc->add_child(find_label); _search_text_label = memnew(Label); - _search_text_label->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font(SNAME("source"), SNAME("EditorFonts"))); - _search_text_label->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size(SNAME("source_size"), SNAME("EditorFonts"))); hbc->add_child(_search_text_label); _progress_bar = memnew(ProgressBar); @@ -598,8 +596,6 @@ FindInFilesPanel::FindInFilesPanel() { } _results_display = memnew(Tree); - _results_display->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font(SNAME("source"), SNAME("EditorFonts"))); - _results_display->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size(SNAME("source_size"), SNAME("EditorFonts"))); _results_display->set_v_size_flags(SIZE_EXPAND_FILL); _results_display->connect("item_selected", callable_mp(this, &FindInFilesPanel::_on_result_selected)); _results_display->connect("item_edited", callable_mp(this, &FindInFilesPanel::_on_item_edited)); @@ -688,13 +684,20 @@ void FindInFilesPanel::stop_search() { void FindInFilesPanel::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_PROCESS: { - _progress_bar->set_as_ratio(_finder->get_progress()); - } break; - case NOTIFICATION_THEME_CHANGED: { _search_text_label->add_theme_font_override("font", get_theme_font(SNAME("source"), SNAME("EditorFonts"))); + _search_text_label->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("source_size"), SNAME("EditorFonts"))); _results_display->add_theme_font_override("font", get_theme_font(SNAME("source"), SNAME("EditorFonts"))); + _results_display->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("source_size"), SNAME("EditorFonts"))); + + // Rebuild search tree. + if (!_finder->get_search_text().is_empty()) { + start_search(); + } + } break; + + case NOTIFICATION_PROCESS: { + _progress_bar->set_as_ratio(_finder->get_progress()); } break; } } |