Skip to content

Commit 206e488

Browse files
AlisterHbrushtyler
authored andcommitted
minor fix and improvement to rendering of selected polygons
1 parent 096badd commit 206e488

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/core/symbology-ng/qgsfillsymbollayerv2.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,16 @@ void QgsSimpleFillSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context
8080
}
8181

8282
QColor selColor = context.selectionColor();
83-
// selColor.setAlphaF( context.alpha() );
83+
QColor selPenColor = selColor == mColor ? selColor : mBorderColor;
84+
if ( ! selectionIsOpaque ) selColor.setAlphaF( context.alpha() );
8485
mSelBrush = QBrush( selColor );
86+
// N.B. unless a "selection line colour" is implemented in addition to the "selection colour" option
87+
// this would mean symbols with "no fill" look the same whether or not they are selected
8588
if ( selectFillStyle )
8689
mSelBrush.setStyle( mBrushStyle );
8790
mBorderColor.setAlphaF( context.alpha() );
8891
mPen = QPen( mBorderColor );
92+
mSelPen = QPen( selPenColor );
8993
mPen.setStyle( mBorderStyle );
9094
mPen.setWidthF( context.outputLineWidth( mBorderWidth ) );
9195
}
@@ -105,6 +109,7 @@ void QgsSimpleFillSymbolLayerV2::renderPolygon( const QPolygonF& points, QList<Q
105109

106110
p->setBrush( context.selected() ? mSelBrush : mBrush );
107111
p->setPen( mPen );
112+
p->setPen( context.selected() ? mSelPen : mPen );
108113

109114
if ( !mOffset.isNull() )
110115
p->translate( mOffset );
@@ -213,8 +218,9 @@ void QgsImageFillSymbolLayer::renderPolygon( const QPolygonF& points, QList<QPol
213218
if ( context.selected() )
214219
{
215220
QColor selColor = context.selectionColor();
216-
if ( ! selectionIsOpaque )
217-
selColor.setAlphaF( context.alpha() );
221+
// Alister - this doesn't seem to work here
222+
//if ( ! selectionIsOpaque )
223+
// selColor.setAlphaF( context.alpha() );
218224
p->setBrush( QBrush( selColor ) );
219225
_renderPolygon( p, points, rings );
220226
}

src/core/symbology-ng/qgsfillsymbollayerv2.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class CORE_EXPORT QgsSimpleFillSymbolLayerV2 : public QgsFillSymbolLayerV2
8080
Qt::PenStyle mBorderStyle;
8181
double mBorderWidth;
8282
QPen mPen;
83+
QPen mSelPen;
8384

8485
QPointF mOffset;
8586
};

0 commit comments

Comments
 (0)