Skip to content

Commit f7397a0

Browse files
committed
Remove confusing Control::is_top_level_control()
It's hard to tell at first glance under what circumstances `is_top_level_control()` returns `true`. So it's hard to decide when to use this method. And it seems to be just a helper function for `Control::get_root_parent_control()`. `is_top_level_control()` seems to only return `true` during entry and exit of canvas.
1 parent 7b1ed52 commit f7397a0

File tree

2 files changed

+0
-11
lines changed

2 files changed

+0
-11
lines changed

scene/gui/control.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -607,11 +607,6 @@ bool Control::_property_get_revert(const StringName &p_name, Variant &r_property
607607

608608
// Global relations.
609609

610-
bool Control::is_top_level_control() const {
611-
ERR_READ_THREAD_GUARD_V(false);
612-
return is_inside_tree() && (!data.parent_canvas_item && !data.RI && is_set_as_top_level());
613-
}
614-
615610
Control *Control::get_parent_control() const {
616611
ERR_READ_THREAD_GUARD_V(nullptr);
617612
return data.parent_control;
@@ -631,10 +626,6 @@ Control *Control::get_root_parent_control() const {
631626
const Control *c = Object::cast_to<Control>(ci);
632627
if (c) {
633628
root = c;
634-
635-
if (c->data.RI || c->is_top_level_control()) {
636-
break;
637-
}
638629
}
639630

640631
ci = ci->get_parent_item();

scene/gui/control.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,6 @@ class Control : public CanvasItem {
428428

429429
// Global relations.
430430

431-
bool is_top_level_control() const;
432-
433431
Control *get_parent_control() const;
434432
Window *get_parent_window() const;
435433
Control *get_root_parent_control() const;

0 commit comments

Comments
 (0)