diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-02-21 23:26:13 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-02-28 14:24:09 +0100 |
commit | f742dabafee7f54e1b77148d547e2031d7cc535e (patch) | |
tree | 5aab3c9c4b9aca10d190a7efa600afb8c7aef213 /scene/gui | |
parent | 01afc442c73661df677c2b93f4037a21992ee45b (diff) |
Signals: Manually port most of remaining connect_compat uses
It's tedious work...
Some can't be ported as they depend on private or protected methods
of different classes, which is not supported by callable_mp (even if
it's a class inherited by the current one).
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/color_picker.cpp | 4 | ||||
-rw-r--r-- | scene/gui/dialogs.cpp | 5 | ||||
-rw-r--r-- | scene/gui/graph_edit.cpp | 2 | ||||
-rw-r--r-- | scene/gui/menu_button.cpp | 5 | ||||
-rw-r--r-- | scene/gui/option_button.cpp | 3 | ||||
-rw-r--r-- | scene/gui/popup_menu.cpp | 5 | ||||
-rw-r--r-- | scene/gui/texture_rect.cpp | 5 |
7 files changed, 18 insertions, 11 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 740cbc3ea4..cbbad79811 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -956,8 +956,8 @@ void ColorPickerButton::_update_picker() { add_child(popup); picker->connect("color_changed", callable_mp(this, &ColorPickerButton::_color_changed)); popup->connect("modal_closed", callable_mp(this, &ColorPickerButton::_modal_closed)); - popup->connect_compat("about_to_show", this, "set_pressed", varray(true)); - popup->connect_compat("popup_hide", this, "set_pressed", varray(false)); + popup->connect("about_to_show", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(true)); + popup->connect("popup_hide", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(false)); picker->set_pick_color(color); picker->set_edit_alpha(edit_alpha); emit_signal("picker_created"); diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 5b7c3fe955..0237be8ad6 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -338,6 +338,8 @@ void WindowDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("get_resizable"), &WindowDialog::get_resizable); ClassDB::bind_method(D_METHOD("get_close_button"), &WindowDialog::get_close_button); + ClassDB::bind_method(D_METHOD("_closed"), &WindowDialog::_closed); // Still used by some connect_compat. + ADD_PROPERTY(PropertyInfo(Variant::STRING, "window_title", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT_INTL), "set_title", "get_title"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "resizable", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT_INTL), "set_resizable", "get_resizable"); } @@ -562,6 +564,9 @@ void AcceptDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("set_autowrap", "autowrap"), &AcceptDialog::set_autowrap); ClassDB::bind_method(D_METHOD("has_autowrap"), &AcceptDialog::has_autowrap); + ClassDB::bind_method(D_METHOD("_ok"), &AcceptDialog::_ok_pressed); // Still used by some connect_compat. + ClassDB::bind_method(D_METHOD("_builtin_text_entered"), &AcceptDialog::_builtin_text_entered); // Still used by some connect_compat. + ADD_SIGNAL(MethodInfo("confirmed")); ADD_SIGNAL(MethodInfo("custom_action", PropertyInfo(Variant::STRING_NAME, "action"))); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index f910f6e749..bd29893bdf 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -259,7 +259,7 @@ void GraphEdit::add_child_notify(Node *p_child) { gn->set_scale(Vector2(zoom, zoom)); gn->connect("offset_changed", callable_mp(this, &GraphEdit::_graph_node_moved), varray(gn)); gn->connect("raise_request", callable_mp(this, &GraphEdit::_graph_node_raised), varray(gn)); - gn->connect_compat("item_rect_changed", connections_layer, "update"); + gn->connect("item_rect_changed", callable_mp((CanvasItem *)connections_layer, &CanvasItem::update)); _graph_node_moved(gn); gn->set_mouse_filter(MOUSE_FILTER_PASS); } diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index a211ee02ed..2b163187c5 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "menu_button.h" + #include "core/os/keyboard.h" #include "scene/main/viewport.h" @@ -137,8 +138,8 @@ MenuButton::MenuButton() { popup->hide(); add_child(popup); popup->set_pass_on_modal_close_click(false); - popup->connect_compat("about_to_show", this, "set_pressed", varray(true)); // For when switching from another MenuButton. - popup->connect_compat("popup_hide", this, "set_pressed", varray(false)); + popup->connect("about_to_show", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(true)); // For when switching from another MenuButton. + popup->connect("popup_hide", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(false)); } MenuButton::~MenuButton() { diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 39ceb06ef9..c185761beb 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "option_button.h" + #include "core/print_string.h" Size2 OptionButton::get_minimum_size() const { @@ -362,7 +363,7 @@ OptionButton::OptionButton() { popup->set_allow_search(true); popup->connect("index_pressed", callable_mp(this, &OptionButton::_selected)); popup->connect("id_focused", callable_mp(this, &OptionButton::_focused)); - popup->connect_compat("popup_hide", this, "set_pressed", varray(false)); + popup->connect("popup_hide", callable_mp((BaseButton *)this, &BaseButton::set_pressed), varray(false)); } OptionButton::~OptionButton() { diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 2d2ae7aac1..c80a8b5f03 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "popup_menu.h" + #include "core/os/input.h" #include "core/os/keyboard.h" #include "core/os/os.h" @@ -1233,7 +1234,7 @@ void PopupMenu::_ref_shortcut(Ref<ShortCut> p_sc) { if (!shortcut_refcount.has(p_sc)) { shortcut_refcount[p_sc] = 1; - p_sc->connect_compat("changed", this, "update"); + p_sc->connect("changed", callable_mp((CanvasItem *)this, &CanvasItem::update)); } else { shortcut_refcount[p_sc] += 1; } @@ -1244,7 +1245,7 @@ void PopupMenu::_unref_shortcut(Ref<ShortCut> p_sc) { ERR_FAIL_COND(!shortcut_refcount.has(p_sc)); shortcut_refcount[p_sc]--; if (shortcut_refcount[p_sc] == 0) { - p_sc->disconnect_compat("changed", this, "update"); + p_sc->disconnect("changed", callable_mp((CanvasItem *)this, &CanvasItem::update)); shortcut_refcount.erase(p_sc); } } diff --git a/scene/gui/texture_rect.cpp b/scene/gui/texture_rect.cpp index 87442f32e8..6dafd3bf4f 100644 --- a/scene/gui/texture_rect.cpp +++ b/scene/gui/texture_rect.cpp @@ -127,7 +127,6 @@ void TextureRect::_bind_methods() { ClassDB::bind_method(D_METHOD("is_flipped_v"), &TextureRect::is_flipped_v); ClassDB::bind_method(D_METHOD("set_stretch_mode", "stretch_mode"), &TextureRect::set_stretch_mode); ClassDB::bind_method(D_METHOD("get_stretch_mode"), &TextureRect::get_stretch_mode); - ClassDB::bind_method(D_METHOD("_texture_changed"), &TextureRect::_texture_changed); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "expand"), "set_expand", "has_expand"); @@ -160,13 +159,13 @@ void TextureRect::set_texture(const Ref<Texture2D> &p_tex) { } if (texture.is_valid()) { - texture->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_texture_changed"); + texture->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &TextureRect::_texture_changed)); } texture = p_tex; if (texture.is_valid()) { - texture->connect_compat(CoreStringNames::get_singleton()->changed, this, "_texture_changed"); + texture->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &TextureRect::_texture_changed)); } update(); |