Skip to content

Commit

Permalink
Handle "Enter" when the search box is focused
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredbaudisch committed Oct 13, 2023
1 parent b137180 commit 0c584dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions editor/project_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2731,6 +2731,14 @@ void ProjectManager::_on_search_term_changed(const String &p_term) {
_update_project_buttons();
}

void ProjectManager::_on_search_term_submitted(const String &p_text) {
if (tabs->get_current_tab() != 0) {
return;
}

_open_selected_projects_ask();
}

void ProjectManager::_bind_methods() {
ClassDB::bind_method("_update_project_buttons", &ProjectManager::_update_project_buttons);
ClassDB::bind_method("_version_button_pressed", &ProjectManager::_version_button_pressed);
Expand Down Expand Up @@ -2899,6 +2907,7 @@ ProjectManager::ProjectManager() {
search_box->set_tooltip_text(TTR("This field filters projects by name and last path component.\nTo filter projects by name and full path, the query must contain at least one `/` character."));
search_box->set_clear_button_enabled(true);
search_box->connect("text_changed", callable_mp(this, &ProjectManager::_on_search_term_changed));
search_box->connect("text_submitted", callable_mp(this, &ProjectManager::_on_search_term_submitted));
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
hb->add_child(search_box);

Expand Down
1 change: 1 addition & 0 deletions editor/project_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ class ProjectManager : public Control {
void _on_order_option_changed(int p_idx);
void _on_tab_changed(int p_tab);
void _on_search_term_changed(const String &p_term);
void _on_search_term_submitted(const String &p_text);

static Ref<Texture2D> _file_dialog_get_icon(const String &p_path);
static Ref<Texture2D> _file_dialog_get_thumbnail(const String &p_path);
Expand Down

0 comments on commit 0c584dd

Please sign in to comment.