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/debugger | |
parent | 4173a4735eb1690132d30430f88fb7d2681c5727 (diff) |
Add the button pressed to some signals in Tree
Diffstat (limited to 'editor/debugger')
-rw-r--r-- | editor/debugger/editor_debugger_tree.cpp | 8 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_tree.h | 2 | ||||
-rw-r--r-- | editor/debugger/script_editor_debugger.cpp | 16 | ||||
-rw-r--r-- | editor/debugger/script_editor_debugger.h | 4 |
4 files changed, 21 insertions, 9 deletions
diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index 3a65d015d5..023204b74a 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -57,7 +57,7 @@ void EditorDebuggerTree::_notification(int p_what) { case NOTIFICATION_POSTINITIALIZE: { connect("cell_selected", callable_mp(this, &EditorDebuggerTree::_scene_tree_selected)); connect("item_collapsed", callable_mp(this, &EditorDebuggerTree::_scene_tree_folded)); - connect("item_rmb_selected", callable_mp(this, &EditorDebuggerTree::_scene_tree_rmb_selected)); + connect("item_mouse_selected", callable_mp(this, &EditorDebuggerTree::_scene_tree_rmb_selected)); } break; } } @@ -100,7 +100,11 @@ void EditorDebuggerTree::_scene_tree_folded(Object *p_obj) { } } -void EditorDebuggerTree::_scene_tree_rmb_selected(const Vector2 &p_position) { +void EditorDebuggerTree::_scene_tree_rmb_selected(const Vector2 &p_position, MouseButton p_button) { + if (p_button != MouseButton::RIGHT) { + return; + } + TreeItem *item = get_item_at_position(p_position); if (!item) { return; diff --git a/editor/debugger/editor_debugger_tree.h b/editor/debugger/editor_debugger_tree.h index 4e38f00ffa..bba524039e 100644 --- a/editor/debugger/editor_debugger_tree.h +++ b/editor/debugger/editor_debugger_tree.h @@ -56,7 +56,7 @@ private: String _get_path(TreeItem *p_item); void _scene_tree_folded(Object *p_obj); void _scene_tree_selected(); - void _scene_tree_rmb_selected(const Vector2 &p_position); + void _scene_tree_rmb_selected(const Vector2 &p_position, MouseButton p_button); void _item_menu_id_pressed(int p_option); void _file_selected(const String &p_file); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 44a7aade09..60486b5286 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -1472,7 +1472,11 @@ void ScriptEditorDebugger::_clear_errors_list() { clear_button->set_disabled(true); } -void ScriptEditorDebugger::_breakpoints_item_rmb_selected(const Vector2 &p_pos) { +void ScriptEditorDebugger::_breakpoints_item_rmb_selected(const Vector2 &p_pos, MouseButton p_button) { + if (p_button != MouseButton::RIGHT) { + return; + } + breakpoints_menu->clear(); breakpoints_menu->set_size(Size2(1, 1)); @@ -1490,7 +1494,11 @@ void ScriptEditorDebugger::_breakpoints_item_rmb_selected(const Vector2 &p_pos) } // Right click on specific file(s) or folder(s). -void ScriptEditorDebugger::_error_tree_item_rmb_selected(const Vector2 &p_pos) { +void ScriptEditorDebugger::_error_tree_item_rmb_selected(const Vector2 &p_pos, MouseButton p_button) { + if (p_button != MouseButton::RIGHT) { + return; + } + item_menu->clear(); item_menu->reset_size(); @@ -1780,7 +1788,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { breakpoints_tree->set_allow_reselect(true); breakpoints_tree->set_allow_rmb_select(true); breakpoints_tree->set_hide_root(true); - breakpoints_tree->connect("item_rmb_selected", callable_mp(this, &ScriptEditorDebugger::_breakpoints_item_rmb_selected)); + breakpoints_tree->connect("item_mouse_selected", callable_mp(this, &ScriptEditorDebugger::_breakpoints_item_rmb_selected)); breakpoints_tree->create_item(); parent_sc->add_child(breakpoints_tree); @@ -1835,7 +1843,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { error_tree->set_hide_root(true); error_tree->set_v_size_flags(SIZE_EXPAND_FILL); error_tree->set_allow_rmb_select(true); - error_tree->connect("item_rmb_selected", callable_mp(this, &ScriptEditorDebugger::_error_tree_item_rmb_selected)); + error_tree->connect("item_mouse_selected", callable_mp(this, &ScriptEditorDebugger::_error_tree_item_rmb_selected)); errors_tab->add_child(error_tree); item_menu = memnew(PopupMenu); diff --git a/editor/debugger/script_editor_debugger.h b/editor/debugger/script_editor_debugger.h index d445fe48d1..aa0a50ff03 100644 --- a/editor/debugger/script_editor_debugger.h +++ b/editor/debugger/script_editor_debugger.h @@ -201,8 +201,8 @@ private: void _clear_errors_list(); - void _breakpoints_item_rmb_selected(const Vector2 &p_pos); - void _error_tree_item_rmb_selected(const Vector2 &p_pos); + void _breakpoints_item_rmb_selected(const Vector2 &p_pos, MouseButton p_button); + void _error_tree_item_rmb_selected(const Vector2 &p_pos, MouseButton p_button); void _item_menu_id_pressed(int p_option); void _tab_changed(int p_tab); |