Merge pull request #106049 from nklbdev/fix-set-focus-on-right-control-on-user-action-show-in-file-system
Fix Set focus on right control on user action "show in file system"
This commit is contained in:
commit
8e744e65b8
2 changed files with 11 additions and 5 deletions
|
|
@ -714,7 +714,7 @@ void FileSystemDock::_set_current_path_line_edit_text(const String &p_path) {
|
|||
}
|
||||
}
|
||||
|
||||
void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_favorites) {
|
||||
void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_favorites, bool p_grab_focus) {
|
||||
String target_path = p_path;
|
||||
bool is_directory = false;
|
||||
|
||||
|
|
@ -767,9 +767,15 @@ void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_fa
|
|||
}
|
||||
item = item->get_next();
|
||||
}
|
||||
if (p_grab_focus) {
|
||||
tree->grab_focus();
|
||||
}
|
||||
} else {
|
||||
(*directory_ptr)->select(0);
|
||||
_update_file_list(false);
|
||||
if (p_grab_focus) {
|
||||
files->grab_focus();
|
||||
}
|
||||
}
|
||||
tree->ensure_cursor_is_visible();
|
||||
}
|
||||
|
|
@ -806,10 +812,10 @@ bool FileSystemDock::_update_filtered_items(TreeItem *p_tree_item) {
|
|||
|
||||
void FileSystemDock::navigate_to_path(const String &p_path) {
|
||||
file_list_search_box->clear();
|
||||
_navigate_to_path(p_path);
|
||||
|
||||
// Ensure that the FileSystem dock is visible.
|
||||
// Try to set the FileSystem dock visible.
|
||||
EditorDockManager::get_singleton()->focus_dock(this);
|
||||
_navigate_to_path(p_path, false, is_visible_in_tree());
|
||||
|
||||
import_dock_needs_update = true;
|
||||
_update_import_dock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ private:
|
|||
Ref<Texture2D> _get_tree_item_icon(bool p_is_valid, const String &p_file_type, const String &p_icon_path);
|
||||
void _create_tree(TreeItem *p_parent, EditorFileSystemDirectory *p_dir, Vector<String> &uncollapsed_paths, bool p_select_in_favorites, bool p_unfold_path = false);
|
||||
void _update_tree(const Vector<String> &p_uncollapsed_paths = Vector<String>(), bool p_uncollapse_root = false, bool p_scroll_to_selected = true);
|
||||
void _navigate_to_path(const String &p_path, bool p_select_in_favorites = false);
|
||||
void _navigate_to_path(const String &p_path, bool p_select_in_favorites = false, bool p_grab_focus = false);
|
||||
bool _update_filtered_items(TreeItem *p_tree_item = nullptr);
|
||||
|
||||
void _file_list_gui_input(Ref<InputEvent> p_event);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue