Fix theme inheritance

This commit is contained in:
Fabio Alessandrelli 2018-01-05 04:22:06 +01:00
parent 003f2dab78
commit a63a82d5e5

View file

@ -861,6 +861,8 @@ Ref<StyleBox> Control::get_stylebox(const StringName &p_name, const StringName &
class_name = ClassDB::get_parent_class_nocheck(class_name); class_name = ClassDB::get_parent_class_nocheck(class_name);
} }
class_name = type;
Control *parent = Object::cast_to<Control>(theme_owner->get_parent()); Control *parent = Object::cast_to<Control>(theme_owner->get_parent());
if (parent) if (parent)
@ -869,8 +871,6 @@ Ref<StyleBox> Control::get_stylebox(const StringName &p_name, const StringName &
theme_owner = NULL; theme_owner = NULL;
} }
class_name = type;
while (class_name != StringName()) { while (class_name != StringName()) {
if (Theme::get_default()->has_stylebox(p_name, class_name)) if (Theme::get_default()->has_stylebox(p_name, class_name))
return Theme::get_default()->get_stylebox(p_name, class_name); return Theme::get_default()->get_stylebox(p_name, class_name);
@ -2155,6 +2155,7 @@ void Control::set_theme(const Ref<Theme> &p_theme) {
data.theme = p_theme; data.theme = p_theme;
if (!p_theme.is_null()) { if (!p_theme.is_null()) {
data.theme_owner = this;
_propagate_theme_changed(this, this); _propagate_theme_changed(this, this);
} else { } else {