Add support for search shortcut to signal connection dialog

This commit is contained in:
passivestar 2024-02-14 11:47:15 +04:00
parent e5a3fd1e53
commit c2c791fed2
2 changed files with 15 additions and 0 deletions

View file

@ -573,6 +573,18 @@ bool ConnectDialog::is_editing() const {
return edit_mode;
}
void ConnectDialog::shortcut_input(const Ref<InputEvent> &p_event) {
const Ref<InputEventKey> &key = p_event;
if (key.is_valid() && key->is_pressed() && !key->is_echo()) {
if (ED_IS_SHORTCUT("editor/open_search", p_event)) {
filter_nodes->grab_focus();
filter_nodes->select_all();
filter_nodes->accept_event();
}
}
}
/*
* Initialize ConnectDialog and populate fields with expected data.
* If creating a connection from scratch, sensible defaults are used.
@ -1531,6 +1543,7 @@ ConnectionsDock::ConnectionsDock() {
connect_dialog = memnew(ConnectDialog);
connect_dialog->connect("connected", callable_mp(NodeDock::get_singleton(), &NodeDock::restore_last_valid_node), CONNECT_DEFERRED);
connect_dialog->set_process_shortcut_input(true);
add_child(connect_dialog);
disconnect_all_dialog = memnew(ConfirmationDialog);

View file

@ -178,6 +178,8 @@ public:
bool get_one_shot() const;
bool is_editing() const;
virtual void shortcut_input(const Ref<InputEvent> &p_event) override;
void init(const ConnectionData &p_cd, const PackedStringArray &p_signal_args, bool p_edit = false);
void popup_dialog(const String p_for_signal);