Skip to content

Commit

Permalink
minor fix and improvement to rendering of selected polygons
Browse files Browse the repository at this point in the history
  • Loading branch information
AlisterH authored and brushtyler committed Aug 27, 2012
1 parent 096badd commit 206e488
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/core/symbology-ng/qgsfillsymbollayerv2.cpp
Expand Up @@ -80,12 +80,16 @@ void QgsSimpleFillSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context
}

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

p->setBrush( context.selected() ? mSelBrush : mBrush );
p->setPen( mPen );
p->setPen( context.selected() ? mSelPen : mPen );

if ( !mOffset.isNull() )
p->translate( mOffset );
Expand Down Expand Up @@ -213,8 +218,9 @@ void QgsImageFillSymbolLayer::renderPolygon( const QPolygonF& points, QList<QPol
if ( context.selected() )
{
QColor selColor = context.selectionColor();
if ( ! selectionIsOpaque )
selColor.setAlphaF( context.alpha() );
// Alister - this doesn't seem to work here
//if ( ! selectionIsOpaque )
// selColor.setAlphaF( context.alpha() );
p->setBrush( QBrush( selColor ) );
_renderPolygon( p, points, rings );
}
Expand Down
1 change: 1 addition & 0 deletions src/core/symbology-ng/qgsfillsymbollayerv2.h
Expand Up @@ -80,6 +80,7 @@ class CORE_EXPORT QgsSimpleFillSymbolLayerV2 : public QgsFillSymbolLayerV2
Qt::PenStyle mBorderStyle;
double mBorderWidth;
QPen mPen;
QPen mSelPen;

QPointF mOffset;
};
Expand Down

0 comments on commit 206e488

Please sign in to comment.