diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-10-03 14:11:08 +0200 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-10-18 06:36:28 +0000 |
commit | aaae0274353544bba9f6eb50ded6c9ffd040dc18 (patch) | |
tree | 8afa27d41fb5e39a02cf84181c49f3924c3d9fbd /src/gui/text/qcssparser.cpp | |
parent | d65631daa48c82cfa1edc636ee10069b1a77fb6d (diff) |
Qt Style Sheets: fix range of hue in hsl/hsv functions
The hue parameter in hsl/hsv was treated the same way as a the other
parameters although it's range is from 0-359 and not from 0-255.
Fix it by extending the maximum range for the first parameter when
parsing a color value given in hsv or hsl.
[ChangeLog][QtGui][CSS] Fix the range of the hue parameter when parsing
a color given in hsl or hsv
Fixes: QTBUG-70897
Change-Id: I9ffa65a89c0abcca62bae35777ca1cbde3375180
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/gui/text/qcssparser.cpp')
-rw-r--r-- | src/gui/text/qcssparser.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index b65e89f69d..1c454b0fca 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -754,7 +754,8 @@ static ColorData parseColorValue(QCss::Value v) for (int i = 0; i < qMin(tokenCount, 7); i += 2) { if (colorDigits.at(i).type == Value::Percentage) { - colorDigits[i].variant = colorDigits.at(i).variant.toReal() * (255. / 100.); + const qreal maxRange = (rgb || i != 0) ? 255. : 359.; + colorDigits[i].variant = colorDigits.at(i).variant.toReal() * (maxRange / 100.); colorDigits[i].type = Value::Number; } else if (colorDigits.at(i).type != Value::Number) { return ColorData(); |