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

@@ -90,11 +90,6 @@ ProjectExportTextureFormatError::ProjectExportTextureFormatError() {
fix_texture_format_button->connect("pressed", callable_mp(this, &ProjectExportTextureFormatError::_on_fix_texture_format_pressed));
}
void ProjectExportDialog::_theme_changed() {
duplicate_preset->set_icon(presets->get_editor_theme_icon(SNAME("Duplicate")));
delete_preset->set_icon(presets->get_editor_theme_icon(SNAME("Remove")));
}
void ProjectExportDialog::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_VISIBILITY_CHANGED: {
@@ -103,6 +98,11 @@ void ProjectExportDialog::_notification(int p_what) {
}
} break;
case NOTIFICATION_THEME_CHANGED: {
duplicate_preset->set_icon(presets->get_editor_theme_icon(SNAME("Duplicate")));
delete_preset->set_icon(presets->get_editor_theme_icon(SNAME("Remove")));
} break;
case NOTIFICATION_READY: {
duplicate_preset->set_icon(presets->get_editor_theme_icon(SNAME("Duplicate")));
delete_preset->set_icon(presets->get_editor_theme_icon(SNAME("Remove")));
@@ -1161,8 +1161,8 @@ ProjectExportDialog::ProjectExportDialog() {
set_clamp_to_embedder(true);
VBoxContainer *main_vb = memnew(VBoxContainer);
main_vb->connect("theme_changed", callable_mp(this, &ProjectExportDialog::_theme_changed));
add_child(main_vb);
HSplitContainer *hbox = memnew(HSplitContainer);
main_vb->add_child(hbox);
hbox->set_v_size_flags(Control::SIZE_EXPAND_FILL);