diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2010-03-05 16:59:01 +0100 |
---|---|---|
committer | Samuli Piippo <samuli.piippo@digia.com> | 2011-06-09 13:05:03 +0300 |
commit | 902071c2233145453f15bbbded446ad294c9c4a1 (patch) | |
tree | ca492d057888d8fae0183f764bbd0fd48519d127 /src/svg/qsvggenerator.cpp | |
parent | abf262548a6ced48858c8f1460c88ce923eab405 (diff) | |
download | qt4-tools-902071c2233145453f15bbbded446ad294c9c4a1.tar.gz |
Fixed vector-effect property output from QSvgGenerator.
The vector-effect property is not inherited by default, so it
must be set on each item with a stroke. It is not sufficient
to set it on G nodes.
Task-number: QTBUG-8733
Reviewed-by: Trond
(cherry picked from commit 7b500ed543bb86429ef6fdb82b103784d6cc6a0c)
Diffstat (limited to 'src/svg/qsvggenerator.cpp')
-rw-r--r-- | src/svg/qsvggenerator.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/svg/qsvggenerator.cpp b/src/svg/qsvggenerator.cpp index 7da3eea2a7..7b3b85984f 100644 --- a/src/svg/qsvggenerator.cpp +++ b/src/svg/qsvggenerator.cpp @@ -310,7 +310,6 @@ public: { *d_func()->stream << QLatin1String("fill=\"none\" "); *d_func()->stream << QLatin1String("stroke=\"black\" "); - *d_func()->stream << QLatin1String("vector-effect=\"non-scaling-stroke\" "); *d_func()->stream << QLatin1String("stroke-width=\"1\" "); *d_func()->stream << QLatin1String("fill-rule=\"evenodd\" "); *d_func()->stream << QLatin1String("stroke-linecap=\"square\" "); @@ -380,13 +379,10 @@ public: break; } - if (spen.widthF() == 0) { - width = QLatin1String("1"); - stream() << "vector-effect=\"non-scaling-stroke\" "; - } + if (spen.widthF() == 0) + stream() <<"stroke-width=\"1\" "; else - width = QString::number(spen.widthF()); - stream() <<"stroke-width=\""<<width<<"\" "; + stream() <<"stroke-width=\"" << spen.widthF() << "\" "; switch (spen.capStyle()) { case Qt::FlatCap: @@ -983,14 +979,11 @@ void QSvgPaintEngine::drawPath(const QPainterPath &p) { Q_D(QSvgPaintEngine); - *d->stream << "<path " - "fill-rule="; - if (p.fillRule() == Qt::OddEvenFill) - *d->stream << "\"evenodd\" "; - else - *d->stream << "\"nonzero\" "; - - *d->stream << "d=\""; + *d->stream << "<path vector-effect=\"" + << (state->pen().isCosmetic() ? "non-scaling-stroke" : "none") + << "\" fill-rule=\"" + << (p.fillRule() == Qt::OddEvenFill ? "evenodd" : "nonzero") + << "\" d=\""; for (int i=0; i<p.elementCount(); ++i) { const QPainterPath::Element &e = p.elementAt(i); @@ -1038,7 +1031,9 @@ void QSvgPaintEngine::drawPolygon(const QPointF *points, int pointCount, path.lineTo(points[i]); if (mode == PolylineMode) { - stream() << "<polyline fill=\"none\" points=\""; + stream() << "<polyline fill=\"none\" vector-effect=\"" + << (state->pen().isCosmetic() ? "non-scaling-stroke" : "none") + << "\" points=\""; for (int i = 0; i < pointCount; ++i) { const QPointF &pt = points[i]; stream() << pt.x() << ',' << pt.y() << ' '; |