Skip to content

Commit 4de6a53

Browse files
committedMay 23, 2020
Ensure symbol opacity is always ignored for selections
Fixes #27859
1 parent 987310f commit 4de6a53

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed
 

‎src/core/symbology/qgsfillsymbollayer.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ void QgsSimpleFillSymbolLayer::startRender( QgsSymbolRenderContext &context )
246246

247247
QColor selColor = context.renderContext().selectionColor();
248248
QColor selPenColor = selColor == mColor ? selColor : mStrokeColor;
249-
if ( ! SELECTION_IS_OPAQUE ) selColor.setAlphaF( context.opacity() );
249+
if ( ! SELECTION_IS_OPAQUE )
250+
selColor.setAlphaF( context.opacity() );
250251
mSelBrush = QBrush( selColor );
251252
// N.B. unless a "selection line color" is implemented in addition to the "selection color" option
252253
// 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
16091610
if ( context.selected() )
16101611
{
16111612
QColor selColor = context.renderContext().selectionColor();
1612-
// Alister - this doesn't seem to work here
1613-
//if ( ! selectionIsOpaque )
1614-
// selColor.setAlphaF( context.alpha() );
16151613
p->setBrush( QBrush( selColor ) );
16161614
_renderPolygon( p, points, rings, context );
16171615
}

‎src/core/symbology/qgsmarkersymbollayer.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ void QgsSimpleMarkerSymbolLayer::startRender( QgsSymbolRenderContext &context )
818818

819819
QColor selBrushColor = context.renderContext().selectionColor();
820820
QColor selPenColor = selBrushColor == mColor ? selBrushColor : mStrokeColor;
821-
if ( context.opacity() < 1 )
821+
if ( context.opacity() < 1 && !SELECTION_IS_OPAQUE )
822822
{
823823
selBrushColor.setAlphaF( context.opacity() );
824824
selPenColor.setAlphaF( context.opacity() );
@@ -3208,7 +3208,10 @@ void QgsFontMarkerSymbolLayer::renderPoint( QPointF point, QgsSymbolRenderContex
32083208
brushColor = mDataDefinedProperties.valueAsColor( QgsSymbolLayer::PropertyFillColor, context.renderContext().expressionContext(), brushColor );
32093209
}
32103210
brushColor = context.selected() ? context.renderContext().selectionColor() : brushColor;
3211-
brushColor.setAlphaF( brushColor.alphaF() * context.opacity() );
3211+
if ( !SELECTION_IS_OPAQUE )
3212+
{
3213+
brushColor.setAlphaF( brushColor.alphaF() * context.opacity() );
3214+
}
32123215
mBrush.setColor( brushColor );
32133216

32143217
QColor penColor = mStrokeColor;

0 commit comments

Comments
 (0)
Please sign in to comment.