Skip to content

Commit

Permalink
Add another early exit shortcut to legend hit test
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 8, 2023
1 parent d1247bc commit e3ffb8d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/core/qgsmaphittest.cpp
Expand Up @@ -116,6 +116,14 @@ void QgsMapHitTest::runHitTestLayer( QgsVectorLayer *vl, SymbolSet &usedSymbols,
return;
}

// if there's no legend items for this layer, shortcut out early
QSet< QString > remainingKeysToFind = r->legendKeys();
if ( remainingKeysToFind.empty() )
{
r->stopRender( context );
return;
}

QgsFeatureRequest request;

const QString rendererFilterExpression = r->filter( vl->fields() );
Expand Down Expand Up @@ -169,8 +177,6 @@ void QgsMapHitTest::runHitTestLayer( QgsVectorLayer *vl, SymbolSet &usedSymbols,
usedSymbols.clear();
usedSymbolsRuleKey.clear();

QSet< QString > remainingKeysToFind = r->legendKeys();

QgsFeature f;
while ( fi.nextFeature( f ) )
{
Expand Down

0 comments on commit e3ffb8d

Please sign in to comment.