From d65631daa48c82cfa1edc636ee10069b1a77fb6d Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 29 Sep 2018 21:54:35 +0200 Subject: Qt Style Sheets: add support for hsl(a) colors The Qt stylesheets color property did not support hsl or hsla although CSS 2.1 does support it. Since QColor natively supports this color model only the color parsing needed to be adjusted. This also adds some stricter checks for a valid css color definition and prints a warning about the issue. [ChangeLog][QtGui][CSS] Added support for hsl/hsla colors Fixes: QTBUG-58804 Change-Id: Ief65a36a7e0ed0d705dc1fe5a8658e8d07fe9a13 Reviewed-by: Allan Sandfeld Jensen --- .../doc/src/widgets-and-layouts/stylesheet.qdoc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/widgets/doc/src') diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc index be6a068d65..623d770f2f 100644 --- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -2881,14 +2881,20 @@ | \tt{rgba(\e{r}, \e{g}, \e{b}, \e{a})} \br | \tt{hsv(\e{h}, \e{s}, \e{v})} \br | \tt{hsva(\e{h}, \e{s}, \e{v}, \e{a})} \br + | \tt{hsl(\e{h}, \e{s}, \e{l})} \br + | \tt{hsla(\e{h}, \e{s}, \e{l}, \e{a})} \br | \tt{#\e{rrggbb}} \br | \l{QColor::setNamedColor()}{Color Name} \br - \li Specifies a color as RGB (red, green, blue) or RGBA - (red, green, blue, alpha) or HSV (hue, saturation, value) or HSVA - (hue, saturation, value, alpha) or a named color. The \c rgb() or \c rgba() - syntax can be used with integer values between 0 and 255, or with - percentages. The value of s, v, and a in \c hsv() or \c hsva() must all - be in the range 0-255; the value of h must be in the range 0-359. + \li Specifies a color as RGB (red, green, blue), RGBA (red, + green, blue, alpha), HSV (hue, saturation, value), HSVA + (hue, saturation, value, alpha), HSL (hue, saturation, + lightness), HSLA (hue, saturation, lightness, alpha) or a + named color. The \c rgb() or \c rgba() syntax can be used + with integer values between 0 and 255, or with percentages. + The value of s, v, l and a in \c hsv(), \c hsva() \c hsl() + or \c hsla() must all be in the range 0-255 or with + percentages, the value of h must be in the range 0-359. + The support for HSL(A) is available since 5.13. Examples: -- cgit v1.2.3