Merge pull request #70419 from Maran23/4-x-editor-layout-dialog-improvements

Do not add child twice and set initial focus in editor layout dialog
This commit is contained in:
Rémi Verschelde 2022-12-21 22:48:38 +01:00
commit 510420efdc
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 7 additions and 3 deletions

View file

@ -98,6 +98,11 @@ void EditorLayoutsDialog::_post_popup() {
for (const String &E : layouts) {
layout_names->add_item(E);
}
if (name->is_visible()) {
name->grab_focus();
} else {
layout_names->grab_focus();
}
}
EditorLayoutsDialog::EditorLayoutsDialog() {
@ -109,7 +114,6 @@ EditorLayoutsDialog::EditorLayoutsDialog() {
layout_names = memnew(ItemList);
layout_names->set_auto_height(true);
makevb->add_margin_child(TTR("Select existing layout:"), layout_names);
makevb->add_child(layout_names);
layout_names->set_custom_minimum_size(Size2(300 * EDSCALE, 1));
layout_names->set_visible(true);
layout_names->set_offset(SIDE_TOP, 5);

View file

@ -5194,15 +5194,15 @@ void EditorNode::_layout_menu_option(int p_id) {
current_menu_option = p_id;
layout_dialog->set_title(TTR("Save Layout"));
layout_dialog->set_ok_button_text(TTR("Save"));
layout_dialog->popup_centered();
layout_dialog->set_name_line_enabled(true);
layout_dialog->popup_centered();
} break;
case SETTINGS_LAYOUT_DELETE: {
current_menu_option = p_id;
layout_dialog->set_title(TTR("Delete Layout"));
layout_dialog->set_ok_button_text(TTR("Delete"));
layout_dialog->popup_centered();
layout_dialog->set_name_line_enabled(false);
layout_dialog->popup_centered();
} break;
case SETTINGS_LAYOUT_DEFAULT: {
_load_docks_from_config(default_layout, "docks");