Skip to content

Commit 0a15a07

Browse files
committed
Replace svg params also for preview
1 parent 7e274d8 commit 0a15a07

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/gui/symbology-ng/qgssymbollayerv2widget.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -538,20 +538,17 @@ class QgsSvgListModel : public QAbstractListModel
538538

539539
if ( role == Qt::DecorationRole ) // icon
540540
{
541-
542541
QPixmap pixmap;
543542
if ( !QPixmapCache::find( entry, pixmap ) )
544543
{
545544
// render SVG file
546-
QSvgRenderer renderer;
547-
QPainter painter;
548-
renderer.load( entry );
549-
pixmap = QPixmap( QSize( 24, 24 ) );
550-
pixmap.fill();
551-
painter.begin( &pixmap );
552-
renderer.render( &painter );
553-
painter.end();
545+
QColor fill, outline;
546+
double outlineWidth;
547+
bool fillParam, outlineParam, outlineWidthParam;
548+
QgsSvgCache::instance()->containsParams( entry, fillParam, fill, outlineParam, outline, outlineWidthParam, outlineWidth );
554549

550+
const QImage& img = QgsSvgCache::instance()->svgAsImage( entry, 8, fill, outline, outlineWidth, 3.5 /*appr. 88 dpi*/, 1.0 );
551+
pixmap = QPixmap::fromImage( img );
555552
QPixmapCache::insert( entry, pixmap );
556553
}
557554

0 commit comments

Comments
 (0)