diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 8fad49a0d25..d2411d97e3e 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1602,6 +1602,7 @@ void Tree::_range_click_timeout() { mb.instance(); ; + propagate_mouse_activated = false; //done from outside, so signal handler cant clear the tree in the middle of emit(which is a common case) blocked++; propagate_mouse_event(pos + cache.offset, 0, 0, false, root, BUTTON_LEFT, mb); blocked--; @@ -1615,6 +1616,11 @@ void Tree::_range_click_timeout() { if (!click_handled) range_click_timer->stop(); + if (propagate_mouse_activated) { + emit_signal("item_activated"); + propagate_mouse_activated = false; + } + } else { range_click_timer->stop(); } @@ -1723,7 +1729,8 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool if (p_doubleclick && (!c.editable || c.mode == TreeItem::CELL_MODE_CUSTOM || c.mode == TreeItem::CELL_MODE_ICON /*|| c.mode==TreeItem::CELL_MODE_CHECK*/)) { //it's confusing for check - emit_signal("item_activated"); + propagate_mouse_activated = true; + incr_search.clear(); return -1; } @@ -2591,6 +2598,7 @@ void Tree::_gui_input(Ref p_event) { click_handled = false; pressing_for_editor = false; + propagate_mouse_activated = false; blocked++; propagate_mouse_event(pos + cache.offset, 0, 0, b->is_doubleclick(), root, b->get_button_index(), b); @@ -2628,6 +2636,11 @@ void Tree::_gui_input(Ref p_event) { } } + if (propagate_mouse_activated) { + emit_signal("item_activated"); + propagate_mouse_activated = false; + } + } break; case BUTTON_WHEEL_UP: { @@ -3945,6 +3958,7 @@ Tree::Tree() { cache.hover_cell = -1; allow_reselect = false; + propagate_mouse_activated = false; } Tree::~Tree() { diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 84eccbf560e..26d64baafb5 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -329,6 +329,8 @@ private: bool range_drag_enabled; Vector2 range_drag_capture_pos; + bool propagate_mouse_activated; + //TreeItem *cursor_item; //int cursor_column;