Skip to content

Commit

Permalink
Replace svg params also for preview
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Jun 29, 2011
1 parent 7e274d8 commit 0a15a07
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/gui/symbology-ng/qgssymbollayerv2widget.cpp
Expand Up @@ -538,20 +538,17 @@ class QgsSvgListModel : public QAbstractListModel

if ( role == Qt::DecorationRole ) // icon
{

QPixmap pixmap;
if ( !QPixmapCache::find( entry, pixmap ) )
{
// render SVG file
QSvgRenderer renderer;
QPainter painter;
renderer.load( entry );
pixmap = QPixmap( QSize( 24, 24 ) );
pixmap.fill();
painter.begin( &pixmap );
renderer.render( &painter );
painter.end();
QColor fill, outline;
double outlineWidth;
bool fillParam, outlineParam, outlineWidthParam;
QgsSvgCache::instance()->containsParams( entry, fillParam, fill, outlineParam, outline, outlineWidthParam, outlineWidth );

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

Expand Down

0 comments on commit 0a15a07

Please sign in to comment.