Skip to content
Permalink
Browse files

Ensure symbol opacity is always ignored for selections

Fixes #27859

(cherry picked from commit 4de6a53)
  • Loading branch information
nyalldawson committed Jun 19, 2020
1 parent 394e4d5 commit b4d303c29b5e4f1097e1db03b6432d7e7e477eb4
Showing with 7 additions and 6 deletions.
  1. +2 −4 src/core/symbology/qgsfillsymbollayer.cpp
  2. +5 −2 src/core/symbology/qgsmarkersymbollayer.cpp
@@ -239,7 +239,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
@@ -1583,9 +1584,6 @@ void QgsImageFillSymbolLayer::renderPolygon( const QPolygonF &points, QList<QPol
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 );
}
@@ -817,7 +817,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() );
@@ -3170,7 +3170,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 b4d303c

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