Merge pull request #88317 from passivestar/signal-connect-search

Add support for search shortcut to signal connection dialog
This commit is contained in:
Rémi Verschelde 2024-02-17 00:23:39 +01:00
commit ef7c045f1c
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 15 additions and 0 deletions

View file

@ -591,6 +591,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.
@ -1554,6 +1566,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

@ -180,6 +180,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);