Merge pull request #14548 from volzhs/fix-out-of-size
Fix Index p_current=0 error at starting editor
This commit is contained in:
commit
1401b07d32
|
@ -294,13 +294,17 @@ void TabContainer::_notification(int p_what) {
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_THEME_CHANGED: {
|
case NOTIFICATION_THEME_CHANGED: {
|
||||||
if (get_tab_count() > 0) {
|
call_deferred("_on_theme_changed"); //wait until all changed theme
|
||||||
call_deferred("set_current_tab", get_current_tab()); //wait until all changed theme
|
|
||||||
}
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabContainer::_on_theme_changed() {
|
||||||
|
if (get_tab_count() > 0) {
|
||||||
|
set_current_tab(get_current_tab());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int TabContainer::_get_tab_width(int p_index) const {
|
int TabContainer::_get_tab_width(int p_index) const {
|
||||||
|
|
||||||
ERR_FAIL_INDEX_V(p_index, get_tab_count(), 0);
|
ERR_FAIL_INDEX_V(p_index, get_tab_count(), 0);
|
||||||
|
@ -658,6 +662,7 @@ void TabContainer::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("get_popup"), &TabContainer::get_popup);
|
ClassDB::bind_method(D_METHOD("get_popup"), &TabContainer::get_popup);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("_child_renamed_callback"), &TabContainer::_child_renamed_callback);
|
ClassDB::bind_method(D_METHOD("_child_renamed_callback"), &TabContainer::_child_renamed_callback);
|
||||||
|
ClassDB::bind_method(D_METHOD("_on_theme_changed"), &TabContainer::_on_theme_changed);
|
||||||
|
|
||||||
ADD_SIGNAL(MethodInfo("tab_changed", PropertyInfo(Variant::INT, "tab")));
|
ADD_SIGNAL(MethodInfo("tab_changed", PropertyInfo(Variant::INT, "tab")));
|
||||||
ADD_SIGNAL(MethodInfo("tab_selected", PropertyInfo(Variant::INT, "tab")));
|
ADD_SIGNAL(MethodInfo("tab_selected", PropertyInfo(Variant::INT, "tab")));
|
||||||
|
|
|
@ -60,6 +60,7 @@ private:
|
||||||
|
|
||||||
Vector<Control *> _get_tabs() const;
|
Vector<Control *> _get_tabs() const;
|
||||||
int _get_tab_width(int p_index) const;
|
int _get_tab_width(int p_index) const;
|
||||||
|
void _on_theme_changed();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _child_renamed_callback();
|
void _child_renamed_callback();
|
||||||
|
|
Loading…
Reference in New Issue