From b8b5bb657767698b5864356fb2549ee9681f1bd6 Mon Sep 17 00:00:00 2001 From: Dmitry Koteroff Date: Sun, 26 Nov 2017 14:49:21 +0300 Subject: Scene Tree Dock: added ability to deselect items when clicking on empty space --- scene/gui/tree.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scene') diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 9213296c55..57c6737848 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1923,6 +1923,9 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool c = c->next; item_h += child_h; } + + if (!c && !p_mod->get_shift() && !p_mod->get_control() && !p_mod->get_command() && !click_handled && p_button != BUTTON_RIGHT) + emit_signal("nothing_selected"); } } @@ -3750,6 +3753,7 @@ void Tree::_bind_methods() { ADD_SIGNAL(MethodInfo("custom_popup_edited", PropertyInfo(Variant::BOOL, "arrow_clicked"))); ADD_SIGNAL(MethodInfo("item_activated")); ADD_SIGNAL(MethodInfo("column_title_pressed", PropertyInfo(Variant::INT, "column"))); + ADD_SIGNAL(MethodInfo("nothing_selected")); BIND_ENUM_CONSTANT(SELECT_SINGLE); BIND_ENUM_CONSTANT(SELECT_ROW); -- cgit v1.2.3