Skip to content

Commit

Permalink
Use QgsLayerStyleOverride in QgsMapHitTest::runHitTestLayer
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jun 11, 2018
1 parent 5c267f2 commit d62c34a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/core/qgsmaphittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ bool QgsMapHitTest::legendKeyVisible( const QString &ruleKey, QgsVectorLayer *la

void QgsMapHitTest::runHitTestLayer( QgsVectorLayer *vl, SymbolSet &usedSymbols, SymbolSet &usedSymbolsRuleKey, QgsRenderContext &context )
{
bool hasStyleOverride = mSettings.layerStyleOverrides().contains( vl->id() );
if ( hasStyleOverride )
vl->styleManager()->setOverrideStyle( mSettings.layerStyleOverrides().value( vl->id() ) );
QgsLayerStyleOverride styleOverride( vl );
if ( mSettings.layerStyleOverrides().contains( vl->id() ) )
styleOverride.setOverrideStyle( mSettings.layerStyleOverrides().value( vl->id() ) );

std::unique_ptr< QgsFeatureRenderer > r( vl->renderer()->clone() );
bool moreSymbolsPerFeature = r->capabilities() & QgsFeatureRenderer::MoreSymbolsPerFeature;
Expand Down Expand Up @@ -199,8 +199,5 @@ void QgsMapHitTest::runHitTestLayer( QgsVectorLayer *vl, SymbolSet &usedSymbols,
usedSymbols = lUsedSymbols;
usedSymbolsRuleKey = lUsedSymbolsRuleKey;
}

if ( hasStyleOverride )
vl->styleManager()->restoreOverrideStyle();
}

0 comments on commit d62c34a

Please sign in to comment.