Skip to content

Commit a6ed51d

Browse files
committed
Merge pull request #118623 from YeldhamDev/too_late_i_guess
Deprecate `TabContainer.all_tabs_in_front` due to now being useless
2 parents a6dccbf + 3729bc8 commit a6ed51d

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

doc/classes/TabContainer.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@
206206
</method>
207207
</methods>
208208
<members>
209-
<member name="all_tabs_in_front" type="bool" setter="set_all_tabs_in_front" getter="is_all_tabs_in_front" default="false">
210-
If [code]true[/code], all tabs are drawn in front of the panel. If [code]false[/code], inactive tabs are drawn behind the panel.
209+
<member name="all_tabs_in_front" type="bool" setter="set_all_tabs_in_front" getter="is_all_tabs_in_front" default="false" deprecated="Due to internal changes this doesn&apos;t do anything anymore, as they&apos;re always in front.">
210+
This doesn't do anything.
211211
</member>
212212
<member name="clip_tabs" type="bool" setter="set_clip_tabs" getter="get_clip_tabs" default="true">
213213
If [code]true[/code], tabs overflowing this node's width will be hidden, displaying two navigation buttons instead. Otherwise, this node's minimum size is updated so that all tabs are visible.

scene/gui/tab_container.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -830,20 +830,18 @@ bool TabContainer::are_tabs_visible() const {
830830
return tabs_visible;
831831
}
832832

833+
#ifndef DISABLE_DEPRECATED
833834
void TabContainer::set_all_tabs_in_front(bool p_in_front) {
834-
if (p_in_front == all_tabs_in_front) {
835-
return;
836-
}
837-
838835
all_tabs_in_front = p_in_front;
839-
840-
remove_child(tab_bar);
841-
add_child(tab_bar, false, all_tabs_in_front ? INTERNAL_MODE_FRONT : INTERNAL_MODE_BACK);
836+
if (all_tabs_in_front) {
837+
WARN_PRINT_ONCE("Due to internal changes, `all_tabs_in_front` doesn't do anything anymore, as they're always in front.");
838+
}
842839
}
843840

844841
bool TabContainer::is_all_tabs_in_front() const {
845842
return all_tabs_in_front;
846843
}
844+
#endif
847845

848846
void TabContainer::set_tab_title(int p_tab, const String &p_title) {
849847
Control *child = get_tab_control(p_tab);
@@ -1189,8 +1187,10 @@ void TabContainer::_bind_methods() {
11891187
ClassDB::bind_method(D_METHOD("get_clip_tabs"), &TabContainer::get_clip_tabs);
11901188
ClassDB::bind_method(D_METHOD("set_tabs_visible", "visible"), &TabContainer::set_tabs_visible);
11911189
ClassDB::bind_method(D_METHOD("are_tabs_visible"), &TabContainer::are_tabs_visible);
1190+
#ifndef DISABLE_DEPRECATED
11921191
ClassDB::bind_method(D_METHOD("set_all_tabs_in_front", "is_front"), &TabContainer::set_all_tabs_in_front);
11931192
ClassDB::bind_method(D_METHOD("is_all_tabs_in_front"), &TabContainer::is_all_tabs_in_front);
1193+
#endif
11941194

11951195
ClassDB::bind_method(D_METHOD("set_tab_title", "tab_idx", "title"), &TabContainer::set_tab_title);
11961196
ClassDB::bind_method(D_METHOD("get_tab_title", "tab_idx"), &TabContainer::get_tab_title);
@@ -1239,7 +1239,9 @@ void TabContainer::_bind_methods() {
12391239
ADD_PROPERTY(PropertyInfo(Variant::INT, "tabs_position", PROPERTY_HINT_ENUM, "Top,Bottom"), "set_tabs_position", "get_tabs_position");
12401240
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "clip_tabs"), "set_clip_tabs", "get_clip_tabs");
12411241
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "tabs_visible"), "set_tabs_visible", "are_tabs_visible");
1242-
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "all_tabs_in_front"), "set_all_tabs_in_front", "is_all_tabs_in_front");
1242+
#ifndef DISABLE_DEPRECATED
1243+
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "all_tabs_in_front", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_all_tabs_in_front", "is_all_tabs_in_front");
1244+
#endif
12431245
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "switch_on_drag_hover"), "set_switch_on_drag_hover", "get_switch_on_drag_hover");
12441246
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "drag_to_rearrange_enabled"), "set_drag_to_rearrange_enabled", "get_drag_to_rearrange_enabled");
12451247
ADD_PROPERTY(PropertyInfo(Variant::INT, "tabs_rearrange_group"), "set_tabs_rearrange_group", "get_tabs_rearrange_group");

scene/gui/tab_container.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ class TabContainer : public Container {
5454
Button *popup_button = nullptr;
5555

5656
bool tabs_visible = true;
57+
#ifndef DISABLE_DEPRECATED
5758
bool all_tabs_in_front = false;
59+
#endif
5860
TabPosition tabs_position = POSITION_TOP;
5961
mutable ObjectID popup_obj_id;
6062
bool use_hidden_tabs_for_min_size = false;
@@ -189,8 +191,10 @@ class TabContainer : public Container {
189191
void set_tabs_visible(bool p_visible);
190192
bool are_tabs_visible() const;
191193

194+
#ifndef DISABLE_DEPRECATED
192195
void set_all_tabs_in_front(bool p_is_front);
193196
bool is_all_tabs_in_front() const;
197+
#endif
194198

195199
void set_tab_title(int p_tab, const String &p_title);
196200
String get_tab_title(int p_tab) const;

0 commit comments

Comments
 (0)