summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-09-10 13:05:02 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-09-23 17:01:29 +0200
commit7c1f94f387ade061eae46e549e1f04a70234b68e (patch)
treef61697bf47e7bc34b9c3cc394b77721be7a6b805 /src/gui
parentdf4cbaf8dc59a5c62ad82a56de8e3596bfecebcd (diff)
Fix Qt6 todo in qcssparser
Colors with wrong number of elements are now invalid. Change-Id: I32c934894de86095d9790baa5f0d2001d76bcd3c Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qcssparser.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index f67c0f485a..24ad9d5092 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -770,11 +770,14 @@ static ColorData parseColorValue(QCss::Value v)
if (tokenCount < 5)
return ColorData();
- // ### Qt6: replace this with a check and return invalid color when token count does not match
- if (hasAlpha && tokenCount != 7)
+ if (hasAlpha && tokenCount != 7) {
qWarning("QCssParser::parseColorValue: Specified color with alpha value but no alpha given: '%s'", qPrintable(lst.join(QLatin1Char(' '))));
- if (!hasAlpha && tokenCount != 5)
+ return ColorData();
+ }
+ if (!hasAlpha && tokenCount != 5) {
qWarning("QCssParser::parseColorValue: Specified color without alpha value but alpha given: '%s'", qPrintable(lst.join(QLatin1Char(' '))));
+ return ColorData();
+ }
int v1 = colorDigits.at(0).variant.toInt();
int v2 = colorDigits.at(2).variant.toInt();