Skip to content

Commit

Permalink
Ensure symbol opacity is always ignored for selections
Browse files Browse the repository at this point in the history
Fixes #27859
  • Loading branch information
nyalldawson committed May 23, 2020
1 parent 987310f commit 4de6a53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/core/symbology/qgsfillsymbollayer.cpp
Expand Up @@ -246,7 +246,8 @@ void QgsSimpleFillSymbolLayer::startRender( QgsSymbolRenderContext &context )

QColor selColor = context.renderContext().selectionColor();
QColor selPenColor = selColor == mColor ? selColor : mStrokeColor;
if ( ! SELECTION_IS_OPAQUE ) selColor.setAlphaF( context.opacity() );
if ( ! SELECTION_IS_OPAQUE )
selColor.setAlphaF( context.opacity() );
mSelBrush = QBrush( selColor );
// N.B. unless a "selection line color" is implemented in addition to the "selection color" option
// this would mean symbols with "no fill" look the same whether or not they are selected
Expand Down Expand Up @@ -1609,9 +1610,6 @@ void QgsImageFillSymbolLayer::renderPolygon( const QPolygonF &points, const QVec
if ( context.selected() )
{
QColor selColor = context.renderContext().selectionColor();
// Alister - this doesn't seem to work here
//if ( ! selectionIsOpaque )
// selColor.setAlphaF( context.alpha() );
p->setBrush( QBrush( selColor ) );
_renderPolygon( p, points, rings, context );
}
Expand Down
7 changes: 5 additions & 2 deletions src/core/symbology/qgsmarkersymbollayer.cpp
Expand Up @@ -818,7 +818,7 @@ void QgsSimpleMarkerSymbolLayer::startRender( QgsSymbolRenderContext &context )

QColor selBrushColor = context.renderContext().selectionColor();
QColor selPenColor = selBrushColor == mColor ? selBrushColor : mStrokeColor;
if ( context.opacity() < 1 )
if ( context.opacity() < 1 && !SELECTION_IS_OPAQUE )
{
selBrushColor.setAlphaF( context.opacity() );
selPenColor.setAlphaF( context.opacity() );
Expand Down Expand Up @@ -3208,7 +3208,10 @@ void QgsFontMarkerSymbolLayer::renderPoint( QPointF point, QgsSymbolRenderContex
brushColor = mDataDefinedProperties.valueAsColor( QgsSymbolLayer::PropertyFillColor, context.renderContext().expressionContext(), brushColor );
}
brushColor = context.selected() ? context.renderContext().selectionColor() : brushColor;
brushColor.setAlphaF( brushColor.alphaF() * context.opacity() );
if ( !SELECTION_IS_OPAQUE )
{
brushColor.setAlphaF( brushColor.alphaF() * context.opacity() );
}
mBrush.setColor( brushColor );

QColor penColor = mStrokeColor;
Expand Down

0 comments on commit 4de6a53

Please sign in to comment.