summaryrefslogtreecommitdiff
path: root/src/svg
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2017-04-10 09:57:47 +0200
committerAndy Shaw <andy.shaw@qt.io>2017-05-30 15:07:19 +0000
commite30065a82e00081ef49fc3152def9991abd149a8 (patch)
tree3550bcfcd084ac279bbf69627a3c6c4fccf24948 /src/svg
parent932d00559be3479f03f00867184b89e75e5e49ad (diff)
downloadqtsvg-e30065a82e00081ef49fc3152def9991abd149a8.tar.gz
Correctly parse the stroke-dasharray attributes
When a stroke-dasharray had multiple values separated by spaces it would end up combining them into one instead of treating them separately. This ensures that it is correctly respected. [ChangeLog] Parses the stroke-dasharray attributes in a SVG file correctly. Change-Id: If6e9babe9f63637e56d3d1dba914557829f9d5f0 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/svg')
-rw-r--r--src/svg/qsvghandler.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index c40091f..c4e2b03 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -1912,13 +1912,12 @@ static void parseCSStoXMLAttrs(const QVector<QCss::Declaration> &declarations,
continue;
QCss::Value val = decl.d->values.first();
QString valueStr;
- if (decl.d->values.count() != 1) {
- for (int i=0; i<decl.d->values.count(); ++i) {
- const QString &value = decl.d->values[i].toString();
- if (value.isEmpty())
+ const int valCount = decl.d->values.count();
+ if (valCount != 1) {
+ for (int i = 0; i < valCount; ++i) {
+ valueStr += decl.d->values[i].toString();
+ if (i + 1 < valCount)
valueStr += QLatin1Char(',');
- else
- valueStr += value;
}
} else {
valueStr = val.toString();