From 4de6a53235a6f7bd657c60d4f4d7160ed371d9df Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Sat, 23 May 2020 11:21:41 +1000 Subject: [PATCH] Ensure symbol opacity is always ignored for selections Fixes #27859 --- src/core/symbology/qgsfillsymbollayer.cpp | 6 ++---- src/core/symbology/qgsmarkersymbollayer.cpp | 7 +++++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/core/symbology/qgsfillsymbollayer.cpp b/src/core/symbology/qgsfillsymbollayer.cpp index 822be6c3ef8b..fbd44b161eed 100644 --- a/src/core/symbology/qgsfillsymbollayer.cpp +++ b/src/core/symbology/qgsfillsymbollayer.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 ); } diff --git a/src/core/symbology/qgsmarkersymbollayer.cpp b/src/core/symbology/qgsmarkersymbollayer.cpp index f51122db9649..badbff5202b4 100644 --- a/src/core/symbology/qgsmarkersymbollayer.cpp +++ b/src/core/symbology/qgsmarkersymbollayer.cpp @@ -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;