Signals: Port more uses of connect_compat

Those were problematic as they call a method of their parent class,
but callable_mp does not allow that unless it's public.

To solve it, we declare a local class that calls the parent class'
method, which now needs to be protected to be accessible in the
derived class.
This commit is contained in:
Rémi Verschelde 2020-02-27 22:49:16 +01:00
parent b8f08b42e7
commit 09a6a2d8f8
19 changed files with 79 additions and 41 deletions

View file

@ -121,6 +121,10 @@ void EditorDirDialog::_item_collapsed(Object *p_item) {
opened_paths.insert(item->get_metadata(0));
}
void EditorDirDialog::_item_activated() {
_ok_pressed(); // From AcceptDialog.
}
void EditorDirDialog::ok_pressed() {
TreeItem *ti = tree->get_selected();
@ -182,7 +186,7 @@ EditorDirDialog::EditorDirDialog() {
tree = memnew(Tree);
add_child(tree);
tree->connect_compat("item_activated", this, "_ok");
tree->connect("item_activated", callable_mp(this, &EditorDirDialog::_item_activated));
makedir = add_button(TTR("Create Folder"), OS::get_singleton()->get_swap_ok_cancel(), "makedir");
makedir->connect("pressed", callable_mp(this, &EditorDirDialog::_make_dir));