mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Add Ctrl + L / Cmd + Shift + G shortcut to focus path bar in FileDialog
This also tweaks EditorFileDialog to use the same shortcut, while making it select the path text after focusing (like in most file managers). Ctrl + L / Cmd + Shift + G can also now be used to focus on the property name in the project settings editor, as well in the Input Map, Autoload, Shader Globals and Global Groups tabs.
This commit is contained in:
@@ -256,11 +256,16 @@ void ProjectSettingsEditor::shortcut_input(const Ref<InputEvent> &p_event) {
|
||||
handled = true;
|
||||
}
|
||||
|
||||
if (k->is_match(InputEventKey::create_reference(KeyModifierMask::CMD_OR_CTRL | Key::F))) {
|
||||
if (ED_IS_SHORTCUT("editor/open_search", p_event)) {
|
||||
_focus_current_search_box();
|
||||
handled = true;
|
||||
}
|
||||
|
||||
if (ED_IS_SHORTCUT("file_dialog/focus_path", p_event)) {
|
||||
_focus_current_path_box();
|
||||
handled = true;
|
||||
}
|
||||
|
||||
if (handled) {
|
||||
set_input_as_handled();
|
||||
}
|
||||
@@ -347,6 +352,27 @@ void ProjectSettingsEditor::_focus_current_search_box() {
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_focus_current_path_box() {
|
||||
Control *tab = tab_container->get_current_tab_control();
|
||||
LineEdit *current_path_box = nullptr;
|
||||
if (tab == general_editor) {
|
||||
current_path_box = property_box;
|
||||
} else if (tab == action_map_editor) {
|
||||
current_path_box = action_map_editor->get_path_box();
|
||||
} else if (tab == autoload_settings) {
|
||||
current_path_box = autoload_settings->get_path_box();
|
||||
} else if (tab == shaders_global_shader_uniforms_editor) {
|
||||
current_path_box = shaders_global_shader_uniforms_editor->get_name_box();
|
||||
} else if (tab == group_settings) {
|
||||
current_path_box = group_settings->get_name_box();
|
||||
}
|
||||
|
||||
if (current_path_box) {
|
||||
current_path_box->grab_focus();
|
||||
current_path_box->select_all();
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_editor_restart() {
|
||||
ProjectSettings::get_singleton()->save();
|
||||
EditorNode::get_singleton()->save_all_scenes();
|
||||
|
||||
Reference in New Issue
Block a user