Defer activated signal after tree has been traversed.
This commit is contained in:
parent
7346afb0ee
commit
6af8b7c955
2 changed files with 17 additions and 1 deletions
|
@ -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<InputEvent> 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<InputEvent> 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() {
|
||||
|
|
|
@ -329,6 +329,8 @@ private:
|
|||
bool range_drag_enabled;
|
||||
Vector2 range_drag_capture_pos;
|
||||
|
||||
bool propagate_mouse_activated;
|
||||
|
||||
//TreeItem *cursor_item;
|
||||
//int cursor_column;
|
||||
|
||||
|
|
Loading…
Reference in a new issue