mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-10 00:13:55 -04:00
Use a minimal expression context in symbol layer tree preview icons
Allows the preview icon to correctly show linked project colors
This commit is contained in:
parent
9419bfdc5f
commit
3c0c2535d6
@ -736,6 +736,11 @@ QIcon QgsSymbolLayerUtils::symbolLayerPreviewIcon( QgsSymbolLayer *layer, QgsUni
|
||||
painter.begin( &pixmap );
|
||||
painter.setRenderHint( QPainter::Antialiasing );
|
||||
QgsRenderContext renderContext = QgsRenderContext::fromQPainter( &painter );
|
||||
// build a minimal expression context
|
||||
QgsExpressionContext expContext;
|
||||
expContext.appendScopes( QgsExpressionContextUtils::globalProjectLayerScopes( nullptr ) );
|
||||
renderContext.setExpressionContext( expContext );
|
||||
|
||||
QgsSymbolRenderContext symbolContext( renderContext, u, 1.0, false, nullptr, nullptr, QgsFields(), scale );
|
||||
layer->drawPreviewIcon( symbolContext, size );
|
||||
painter.end();
|
||||
|
Loading…
x
Reference in New Issue
Block a user