diff options
author | trollodel <33117082+trollodel@users.noreply.github.com> | 2021-09-18 09:33:18 +0200 |
---|---|---|
committer | trollodel <33117082+trollodel@users.noreply.github.com> | 2022-05-21 17:16:52 +0200 |
commit | 307427af89d4cbbcf32099f6009739f50c8bd0a0 (patch) | |
tree | 73915e75837b66834834b1e124687258f886b05e /editor/import | |
parent | 4173a4735eb1690132d30430f88fb7d2681c5727 (diff) |
Add the button pressed to some signals in Tree
Diffstat (limited to 'editor/import')
-rw-r--r-- | editor/import/dynamic_font_import_settings.cpp | 32 | ||||
-rw-r--r-- | editor/import/dynamic_font_import_settings.h | 8 | ||||
-rw-r--r-- | editor/import/scene_import_settings.cpp | 8 | ||||
-rw-r--r-- | editor/import/scene_import_settings.h | 2 |
4 files changed, 35 insertions, 15 deletions
diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp index 815366b279..e546f01205 100644 --- a/editor/import/dynamic_font_import_settings.cpp +++ b/editor/import/dynamic_font_import_settings.cpp @@ -547,7 +547,11 @@ void DynamicFontImportSettings::_variation_selected() { } } -void DynamicFontImportSettings::_variation_remove(Object *p_item, int p_column, int p_id) { +void DynamicFontImportSettings::_variation_remove(Object *p_item, int p_column, int p_id, MouseButton p_button) { + if (p_button != MouseButton::LEFT) { + return; + } + TreeItem *vars_item = (TreeItem *)p_item; ERR_FAIL_NULL(vars_item); @@ -832,7 +836,11 @@ void DynamicFontImportSettings::_lang_add_item(const String &p_locale) { lang_item->set_button_color(2, 0, Color(1, 1, 1, 0.75)); } -void DynamicFontImportSettings::_lang_remove(Object *p_item, int p_column, int p_id) { +void DynamicFontImportSettings::_lang_remove(Object *p_item, int p_column, int p_id, MouseButton p_button) { + if (p_button != MouseButton::LEFT) { + return; + } + TreeItem *lang_item = (TreeItem *)p_item; ERR_FAIL_NULL(lang_item); @@ -864,7 +872,11 @@ void DynamicFontImportSettings::_ot_add_item(int p_option) { ot_item->set_button_color(2, 0, Color(1, 1, 1, 0.75)); } -void DynamicFontImportSettings::_ot_remove(Object *p_item, int p_column, int p_id) { +void DynamicFontImportSettings::_ot_remove(Object *p_item, int p_column, int p_id, MouseButton p_button) { + if (p_button != MouseButton::LEFT) { + return; + } + TreeItem *ot_item = (TreeItem *)p_item; ERR_FAIL_NULL(ot_item); @@ -891,7 +903,11 @@ void DynamicFontImportSettings::_script_add_item(int p_option) { script_item->set_button_color(2, 0, Color(1, 1, 1, 0.75)); } -void DynamicFontImportSettings::_script_remove(Object *p_item, int p_column, int p_id) { +void DynamicFontImportSettings::_script_remove(Object *p_item, int p_column, int p_id, MouseButton p_button) { + if (p_button != MouseButton::LEFT) { + return; + } + TreeItem *script_item = (TreeItem *)p_item; ERR_FAIL_NULL(script_item); @@ -1487,7 +1503,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() { vars_list->set_column_expand(1, false); vars_list->set_column_custom_minimum_width(1, 50 * EDSCALE); vars_list->connect("item_selected", callable_mp(this, &DynamicFontImportSettings::_variation_selected)); - vars_list->connect("button_pressed", callable_mp(this, &DynamicFontImportSettings::_variation_remove)); + vars_list->connect("button_clicked", callable_mp(this, &DynamicFontImportSettings::_variation_remove)); vars_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); inspector_vars = memnew(EditorInspector); @@ -1639,7 +1655,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() { lang_list->set_column_custom_minimum_width(1, 80 * EDSCALE); lang_list->set_column_expand(2, false); lang_list->set_column_custom_minimum_width(2, 50 * EDSCALE); - lang_list->connect("button_pressed", callable_mp(this, &DynamicFontImportSettings::_lang_remove)); + lang_list->connect("button_clicked", callable_mp(this, &DynamicFontImportSettings::_lang_remove)); lang_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); HBoxContainer *hb_script = memnew(HBoxContainer); @@ -1667,7 +1683,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() { script_list->set_column_custom_minimum_width(1, 80 * EDSCALE); script_list->set_column_expand(2, false); script_list->set_column_custom_minimum_width(2, 50 * EDSCALE); - script_list->connect("button_pressed", callable_mp(this, &DynamicFontImportSettings::_script_remove)); + script_list->connect("button_clicked", callable_mp(this, &DynamicFontImportSettings::_script_remove)); script_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); HBoxContainer *hb_ot = memnew(HBoxContainer); @@ -1695,7 +1711,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() { ot_list->set_column_custom_minimum_width(1, 80 * EDSCALE); ot_list->set_column_expand(2, false); ot_list->set_column_custom_minimum_width(2, 50 * EDSCALE); - ot_list->connect("button_pressed", callable_mp(this, &DynamicFontImportSettings::_ot_remove)); + ot_list->connect("button_clicked", callable_mp(this, &DynamicFontImportSettings::_ot_remove)); ot_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); // Common diff --git a/editor/import/dynamic_font_import_settings.h b/editor/import/dynamic_font_import_settings.h index 154f347b77..ba75c98057 100644 --- a/editor/import/dynamic_font_import_settings.h +++ b/editor/import/dynamic_font_import_settings.h @@ -91,7 +91,7 @@ class DynamicFontImportSettings : public ConfirmationDialog { void _variation_add(); void _variation_selected(); - void _variation_remove(Object *p_item, int p_column, int p_id); + void _variation_remove(Object *p_item, int p_column, int p_id, MouseButton p_button); void _variation_changed(const String &p_edited_property); void _variations_validate(); @@ -145,15 +145,15 @@ class DynamicFontImportSettings : public ConfirmationDialog { void _lang_add(); void _lang_add_item(const String &p_locale); - void _lang_remove(Object *p_item, int p_column, int p_id); + void _lang_remove(Object *p_item, int p_column, int p_id, MouseButton p_button); void _script_add(); void _script_add_item(int p_option); - void _script_remove(Object *p_item, int p_column, int p_id); + void _script_remove(Object *p_item, int p_column, int p_id, MouseButton p_button); void _ot_add(); void _ot_add_item(int p_option); - void _ot_remove(Object *p_item, int p_column, int p_id); + void _ot_remove(Object *p_item, int p_column, int p_id, MouseButton p_button); // Common diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp index 3c68477564..83dff30dfa 100644 --- a/editor/import/scene_import_settings.cpp +++ b/editor/import/scene_import_settings.cpp @@ -969,7 +969,11 @@ void SceneImportSettings::_save_path_changed(const String &p_path) { } } -void SceneImportSettings::_browse_save_callback(Object *p_item, int p_column, int p_id) { +void SceneImportSettings::_browse_save_callback(Object *p_item, int p_column, int p_id, MouseButton p_button) { + if (p_button != MouseButton::LEFT) { + return; + } + TreeItem *item = Object::cast_to<TreeItem>(p_item); String path = item->get_text(1); @@ -1331,7 +1335,7 @@ SceneImportSettings::SceneImportSettings() { add_child(external_paths); external_path_tree = memnew(Tree); external_paths->add_child(external_path_tree); - external_path_tree->connect("button_pressed", callable_mp(this, &SceneImportSettings::_browse_save_callback)); + external_path_tree->connect("button_clicked", callable_mp(this, &SceneImportSettings::_browse_save_callback)); external_paths->connect("confirmed", callable_mp(this, &SceneImportSettings::_save_dir_confirm)); external_path_tree->set_columns(3); external_path_tree->set_column_titles_visible(true); diff --git a/editor/import/scene_import_settings.h b/editor/import/scene_import_settings.h index a4008582ce..81d13166ab 100644 --- a/editor/import/scene_import_settings.h +++ b/editor/import/scene_import_settings.h @@ -182,7 +182,7 @@ class SceneImportSettings : public ConfirmationDialog { TreeItem *save_path_item = nullptr; void _save_path_changed(const String &p_path); - void _browse_save_callback(Object *p_item, int p_column, int p_id); + void _browse_save_callback(Object *p_item, int p_column, int p_id, MouseButton p_button); void _save_dir_confirm(); Dictionary base_subresource_settings; |