summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-09-12 16:27:12 +0200
committerMarc Mutz <marc.mutz@kdab.com>2016-09-13 19:58:25 +0000
commit96d6354cf7e13797ab419ca9e74b89dd33f68ffe (patch)
tree8e3698e3bd0988b5d5d1c42926758ade386af7a8
parent74bc4617dd5a38abb60aff8b252001cb2ff9c7b8 (diff)
downloadqtsvg-96d6354cf7e13797ab419ca9e74b89dd33f68ffe.tar.gz
QSvgGenerator: prefer QColor::name() over QString::arg() cascade
Change-Id: I994bcc0a4d0587dbb1f0566a7a6b3f110f1175aa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r--src/svg/qsvggenerator.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/svg/qsvggenerator.cpp b/src/svg/qsvggenerator.cpp
index 6e99367..6bca27f 100644
--- a/src/svg/qsvggenerator.cpp
+++ b/src/svg/qsvggenerator.cpp
@@ -285,11 +285,7 @@ public:
}
for (const QGradientStop &stop : qAsConst(stops)) {
- QString color =
- QString::fromLatin1("#%1%2%3")
- .arg(stop.second.red(), 2, 16, QLatin1Char('0'))
- .arg(stop.second.green(), 2, 16, QLatin1Char('0'))
- .arg(stop.second.blue(), 2, 16, QLatin1Char('0'));
+ const QString color = stop.second.name(QColor::HexRgb);
str << QLatin1String(" <stop offset=\"")<< stop.first << QLatin1String("\" ")
<< QLatin1String("stop-color=\"") << color << QLatin1String("\" ")
<< QLatin1String("stop-opacity=\"") << stop.second.alphaF() <<QLatin1String("\" />\n");