diff options
Diffstat (limited to 'scene/gui/tree.cpp')
| -rw-r--r-- | scene/gui/tree.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 4ed52bd465..a4c239cf53 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1476,7 +1476,7 @@ Size2 TreeItem::get_minimum_size(int p_column) { void TreeItem::_call_recursive_bind(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (p_argcount < 1) { r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; - r_error.argument = 0; + r_error.expected = 1; return; } @@ -2050,7 +2050,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 int text_width = item_width - theme_cache.inner_item_margin_left - theme_cache.inner_item_margin_right; if (p_item->cells[i].icon.is_valid()) { - text_width -= p_item->cells[i].get_icon_size().x + theme_cache.h_separation; + text_width -= _get_cell_icon_size(p_item->cells[i]).x + theme_cache.h_separation; } p_item->cells.write[i].text_buf->set_width(text_width); @@ -2770,21 +2770,9 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int x -= theme_cache.h_separation; } - if (!p_item->disable_folding && !hide_folding && !p_item->cells[col].editable && !p_item->cells[col].selectable && p_item->get_first_child()) { - if (enable_recursive_folding && p_mod->is_shift_pressed()) { - p_item->set_collapsed_recursive(!p_item->is_collapsed()); - } else { - p_item->set_collapsed(!p_item->is_collapsed()); - } - return -1; //collapse/uncollapse because nothing can be done with item - } - const TreeItem::Cell &c = p_item->cells[col]; - bool already_selected = c.selected; - bool already_cursor = (p_item == selected_item) && col == selected_col; - - if (!cache.rtl && p_item->cells[col].buttons.size()) { + if (!cache.rtl && !p_item->cells[col].buttons.is_empty()) { int button_w = 0; for (int j = p_item->cells[col].buttons.size() - 1; j >= 0; j--) { Ref<Texture2D> b = p_item->cells[col].buttons[j].texture; @@ -2827,6 +2815,18 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int col_width -= w + theme_cache.button_margin; } + if (!p_item->disable_folding && !hide_folding && !p_item->cells[col].editable && !p_item->cells[col].selectable && p_item->get_first_child()) { + if (enable_recursive_folding && p_mod->is_shift_pressed()) { + p_item->set_collapsed_recursive(!p_item->is_collapsed()); + } else { + p_item->set_collapsed(!p_item->is_collapsed()); + } + return -1; // Collapse/uncollapse, because nothing can be done with the item. + } + + bool already_selected = c.selected; + bool already_cursor = (p_item == selected_item) && col == selected_col; + if (p_button == MouseButton::LEFT || (p_button == MouseButton::RIGHT && allow_rmb_select)) { /* process selection */ @@ -3142,7 +3142,7 @@ void Tree::value_editor_changed(double p_value) { TreeItem::Cell &c = popup_edited_item->cells.write[popup_edited_item_col]; c.val = p_value; - text_editor->set_text(String::num(c.val, Math::range_step_decimals(c.step))); + line_editor->set_text(String::num(c.val, Math::range_step_decimals(c.step))); item_edited(popup_edited_item_col, popup_edited_item); queue_redraw(); @@ -3815,7 +3815,7 @@ void Tree::gui_input(const Ref<InputEvent> &p_event) { } if (mb->get_button_index() == MouseButton::LEFT) { - if (get_item_at_position(mb->get_position()) == nullptr && !mb->is_shift_pressed() && !mb->is_ctrl_pressed() && !mb->is_command_or_control_pressed()) { + if (get_item_at_position(mb->get_position()) == nullptr && !mb->is_shift_pressed() && !mb->is_command_or_control_pressed()) { emit_signal(SNAME("nothing_selected")); } } |
