Skip to content

Commit dc961d5

Browse files
committed
[composer] Make parameterised SVG arrow heads respect colors (fix #14997)
(cherry-picked from 78c434a)
1 parent 57930ea commit dc961d5

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

src/core/composer/qgscomposerarrow.cpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "qgscomposition.h"
2020
#include "qgscomposerutils.h"
2121
#include "qgssymbollayerv2utils.h"
22+
#include "qgssvgcache.h"
2223
#include <QPainter>
2324
#include <QSvgRenderer>
2425
#include <QVector2D>
@@ -252,22 +253,14 @@ void QgsComposerArrow::drawSVGMarker( QPainter* p, MarkerType type, const QStrin
252253
imageFixPoint.setY( 0 );
253254
}
254255

255-
//rasterize svg
256+
QString svgFileName = ( type == StartMarker ? mStartMarkerFile : mEndMarkerFile );
257+
if ( svgFileName.isEmpty() )
258+
return;
259+
256260
QSvgRenderer r;
257-
if ( type == StartMarker )
258-
{
259-
if ( mStartMarkerFile.isEmpty() || !r.load( mStartMarkerFile ) )
260-
{
261-
return;
262-
}
263-
}
264-
else //end marker
265-
{
266-
if ( mEndMarkerFile.isEmpty() || !r.load( mEndMarkerFile ) )
267-
{
268-
return;
269-
}
270-
}
261+
const QByteArray &svgContent = QgsSvgCache::instance()->svgContent( svgFileName, mArrowHeadWidth, mArrowHeadFillColor, mArrowHeadOutlineColor, mArrowHeadOutlineWidth,
262+
1.0, 1.0 );
263+
r.load( svgContent );
271264

272265
p->save();
273266
p->setRenderHint( QPainter::Antialiasing );

0 commit comments

Comments
 (0)