diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-04-08 16:32:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-08 16:32:38 +0200 |
commit | 35066f39ff111ee0e9d4aba534bb08fc2d686156 (patch) | |
tree | ec346cf72ca63cbd293d9a531cf7d7a3ec8fdabc /scene/gui | |
parent | 084b882c0a1957ca15bbb6ddadce050e81315f58 (diff) | |
parent | ce126d4b79bc56bf0b4e36bcc9a9e53b3667494f (diff) |
Merge pull request #47697 from gongpha/color-picker-bars-fix-raw-mode
Fix ColorPicker's RGB bars are show in RAW mode and other
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/color_picker.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 1a9ad23434..78524a856a 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -115,19 +115,22 @@ void ColorPicker::_update_controls() { if (raw_mode_enabled) { for (int i = 0; i < 3; i++) { - scroll[i]->add_theme_icon_override("grabber", Ref<Texture2D>()); - scroll[i]->add_theme_icon_override("grabber_highlight", Ref<Texture2D>()); - scroll[i]->add_theme_style_override("slider", Ref<StyleBox>()); - scroll[i]->add_theme_style_override("grabber_area", Ref<StyleBox>()); - scroll[i]->add_theme_style_override("grabber_area_highlight", Ref<StyleBox>()); + scroll[i]->remove_theme_icon_override("grabber"); + scroll[i]->remove_theme_icon_override("grabber_highlight"); + scroll[i]->remove_theme_style_override("slider"); + scroll[i]->remove_theme_style_override("grabber_area"); + scroll[i]->remove_theme_style_override("grabber_area_highlight"); } } else { - for (int i = 0; i < 3; i++) { - scroll[i]->add_theme_icon_override("grabber", get_theme_icon("bar_arrow")); - scroll[i]->add_theme_icon_override("grabber_highlight", get_theme_icon("bar_arrow")); - scroll[i]->add_theme_style_override("slider", Ref<StyleBoxEmpty>(memnew(StyleBoxEmpty))); - scroll[i]->add_theme_style_override("grabber_area", Ref<StyleBoxEmpty>(memnew(StyleBoxEmpty))); - scroll[i]->add_theme_style_override("grabber_area_highlight", Ref<StyleBoxEmpty>(memnew(StyleBoxEmpty))); + Ref<StyleBoxEmpty> style_box_empty(memnew(StyleBoxEmpty)); + Ref<Texture2D> bar_arrow = get_theme_icon("bar_arrow"); + + for (int i = 0; i < 4; i++) { + scroll[i]->add_theme_icon_override("grabber", bar_arrow); + scroll[i]->add_theme_icon_override("grabber_highlight", bar_arrow); + scroll[i]->add_theme_style_override("slider", style_box_empty); + scroll[i]->add_theme_style_override("grabber_area", style_box_empty); + scroll[i]->add_theme_style_override("grabber_area_highlight", style_box_empty); } } @@ -887,12 +890,8 @@ ColorPicker::ColorPicker() : vbr->add_child(hbc); } + labels[3]->set_text("A"); - scroll[3]->add_theme_icon_override("grabber", get_theme_icon("bar_arrow")); - scroll[3]->add_theme_icon_override("grabber_highlight", get_theme_icon("bar_arrow")); - scroll[3]->add_theme_style_override("slider", Ref<StyleBoxEmpty>(memnew(StyleBoxEmpty))); - scroll[3]->add_theme_style_override("grabber_area", Ref<StyleBoxEmpty>(memnew(StyleBoxEmpty))); - scroll[3]->add_theme_style_override("grabber_area_highlight", Ref<StyleBoxEmpty>(memnew(StyleBoxEmpty))); HBoxContainer *hhb = memnew(HBoxContainer); vbr->add_child(hhb); |