Skip to content

Commit

Permalink
Fix QgsSymbol::drawPreviewIcon
Browse files Browse the repository at this point in the history
Transform the "Opacity" value calculated by Data Defined Override expression from [0-100] range to [0-1] range.
  • Loading branch information
agiudiceandrea authored Mar 20, 2024
1 parent 522747c commit 96f6649
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/symbology/qgssymbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ void QgsSymbol::drawPreviewIcon( QPainter *painter, QSize size, QgsRenderContext
const bool prevForceVector = context->forceVectorOutput();
context->setForceVectorOutput( true );

const double opacity = expressionContext ? dataDefinedProperties().valueAsDouble( QgsSymbol::PropertyOpacity, *expressionContext, mOpacity ) : mOpacity;
const double opacity = expressionContext ? dataDefinedProperties().valueAsDouble( QgsSymbol::PropertyOpacity, *expressionContext, mOpacity * 100 ) * 0.01 : mOpacity;

QgsSymbolRenderContext symbolContext( *context, Qgis::RenderUnit::Unknown, opacity, false, mRenderHints, nullptr );
symbolContext.setSelected( selected );
Expand Down

0 comments on commit 96f6649

Please sign in to comment.