Skip to content

Commit

Permalink
Fix wheel going gray when changing color space
Browse files Browse the repository at this point in the history
This was caused by an attempt to convert the hue to the current color
space, which may be an indeterminate value if the current color is fully
desaturated, causing Qt to return -1. Hue is the same value in all three
color spaces though, hsvHueF just calls hueF under the hood, so this
commit just removes the hue modification when changing the color space
altogether.
  • Loading branch information
askmeaboutlo0m committed Aug 18, 2023
1 parent 0e764a4 commit cd56ac6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/desktop/bundled/QtColorWidgets/color_wheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,21 +291,19 @@ void ColorWheel::setColorSpace(color_widgets::ColorWheel::ColorSpaceEnum space)
switch ( space )
{
case ColorHSL:
p->hue = old_col.hueF();
p->sat = utils::color_HSL_saturationF(old_col);
p->val = utils::color_lightnessF(old_col);
p->color_from = &utils::color_from_hsl;
p->rainbow_from_hue = &utils::rainbow_hsv;
break;
case ColorHSV:
p->hue = old_col.hsvHueF();
case ColorHSV: {
p->sat = old_col.hsvSaturationF();
p->val = old_col.valueF();
p->color_from = &QColor::fromHsvF;
p->rainbow_from_hue = &utils::rainbow_hsv;
break;
}
case ColorLCH:
p->hue = old_col.hueF();
p->sat = utils::color_chromaF(old_col);
p->val = utils::color_lumaF(old_col);
p->color_from = &utils::color_from_lch;
Expand Down

0 comments on commit cd56ac6

Please sign in to comment.