Merge pull request #70410 from Maran23/4-x-search-result-theme-update

Rebuild search result tree when the theme is changed
This commit is contained in:
Rémi Verschelde 2022-12-21 18:31:05 +01:00
commit f1b23e8c39
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -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;
}
}