Skip to content

Commit

Permalink
Turn antialiasing flag on when rendering legend symbol preview
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Apr 24, 2019
1 parent 0daeacb commit 5a4f01e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/layertree/qgslayertreemodellegendnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ QSizeF QgsSymbolLegendNode::drawSymbol( const QgsLegendSettings &settings, ItemC
QgsRenderContext context;
context.setScaleFactor( settings.dpi() / 25.4 );
context.setRendererScale( settings.mapScale() );
context.setFlag( QgsRenderContext::Antialiasing, true );
context.setMapToPixel( QgsMapToPixel( 1 / ( settings.mmPerMapUnit() * context.scaleFactor() ) ) );
context.setForceVectorOutput( true );
context.setPainter( ctx ? ctx->painter : nullptr );
Expand Down Expand Up @@ -428,6 +429,7 @@ QSizeF QgsSymbolLegendNode::drawSymbol( const QgsLegendSettings &settings, ItemC
QImage tempImage = QImage( tempImageSize, QImage::Format_ARGB32 );
tempImage.fill( Qt::transparent );
QPainter imagePainter( &tempImage );
imagePainter.setRenderHint( QPainter::Antialiasing );
context.setPainter( &imagePainter );
s->drawPreviewIcon( &imagePainter, tempImageSize, &context );
context.setPainter( ctx->painter );
Expand Down

0 comments on commit 5a4f01e

Please sign in to comment.