Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Turn antialiasing flag on when rendering legend symbol preview
- Loading branch information
Showing
with
2 additions
and
0 deletions.
-
+2
−0
src/core/layertree/qgslayertreemodellegendnode.cpp
|
@@ -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 ); |
|
@@ -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 ); |
|
|