Skip to content
Permalink
Browse files

Ensure symbol opacity is always ignored for selections

Fixes #27859
  • Loading branch information
nyalldawson committed May 23, 2020
1 parent 987310f commit 4de6a53235a6f7bd657c60d4f4d7160ed371d9df
Showing with 7 additions and 6 deletions.
  1. +2 −4 src/core/symbology/qgsfillsymbollayer.cpp
  2. +5 −2 src/core/symbology/qgsmarkersymbollayer.cpp
@@ -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
@@ -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 );
}
@@ -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() );
@@ -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;

0 comments on commit 4de6a53

Please sign in to comment.
You can’t perform that action at this time.