Skip to content

Commit 58b3e20

Browse files
committed
Fixes #13999: feature count on rule based renderer is valid for ELSE statement
1 parent 0b5c2ae commit 58b3e20

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/core/symbology/qgsrulebasedrenderer.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,9 @@ bool QgsRuleBasedRenderer::Rule::willRenderFeature( QgsFeature &feat, QgsRenderC
553553
lst.removeOne( rule );
554554

555555
if ( lst.empty() )
556+
{
556557
return true;
558+
}
557559
}
558560
else if ( !rule->isElse( ) && rule->willRenderFeature( feat, context ) )
559561
{
@@ -587,7 +589,26 @@ QSet<QString> QgsRuleBasedRenderer::Rule::legendKeysForFeature( QgsFeature &feat
587589

588590
Q_FOREACH ( Rule *rule, mActiveChildren )
589591
{
590-
lst.unite( rule->legendKeysForFeature( feat, context ) );
592+
bool validKey = false;
593+
if ( rule->isElse() )
594+
{
595+
RuleList lst = rulesForFeature( feat, context, false );
596+
lst.removeOne( rule );
597+
598+
if ( lst.empty() )
599+
{
600+
validKey = true;
601+
}
602+
}
603+
else if ( !rule->isElse( ) && rule->willRenderFeature( feat, context ) )
604+
{
605+
validKey = true;
606+
}
607+
608+
if ( validKey )
609+
{
610+
lst.unite( rule->legendKeysForFeature( feat, context ) );
611+
}
591612
}
592613
return lst;
593614
}

0 commit comments

Comments
 (0)