Skip to content

Commit

Permalink
LibGUI: Update color widgets when has_alpha is toggled in ColorPicker
Browse files Browse the repository at this point in the history
Fixing a bug where the alpha spinbox wasn't immediately disabled when
color_has_alpha_channel was set to false.
  • Loading branch information
xTibor authored and awesomekling committed Sep 26, 2020
1 parent 01915a3 commit 8b29311
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Libraries/LibGUI/ColorPicker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ ColorPicker::~ColorPicker()
{
}

void ColorPicker::set_color_has_alpha_channel(bool has_alpha)
{
if (m_color_has_alpha_channel == has_alpha)
return;

m_color_has_alpha_channel = has_alpha;
update_color_widgets();
}

void ColorPicker::build_ui()
{
auto& root_container = set_main_widget<Widget>();
Expand Down
2 changes: 1 addition & 1 deletion Libraries/LibGUI/ColorPicker.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ColorPicker final : public Dialog {
virtual ~ColorPicker() override;

bool color_has_alpha_channel() const { return m_color_has_alpha_channel; }
void set_color_has_alpha_channel(bool has_alpha) { m_color_has_alpha_channel = has_alpha; }
void set_color_has_alpha_channel(bool);
Color color() const { return m_color; }

private:
Expand Down

0 comments on commit 8b29311

Please sign in to comment.