Skip to content

Commit

Permalink
Legend: leave away empty groups (fix #12969)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent authored and nyalldawson committed Jun 16, 2016
1 parent 7f7b9f9 commit c783475
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/core/qgslegendrenderer.cpp
Expand Up @@ -161,6 +161,7 @@ QList<QgsLegendRenderer::Atom> QgsLegendRenderer::createAtomList( QgsLayerTreeGr

// Group subitems
QList<Atom> groupAtoms = createAtomList( nodeGroup, splitLayer );
bool hasSubItems = groupAtoms.size() > 0;

if ( nodeLegendStyle( nodeGroup ) != QgsComposerLegendStyle::Hidden )
{
Expand Down Expand Up @@ -188,7 +189,12 @@ QList<QgsLegendRenderer::Atom> QgsLegendRenderer::createAtomList( QgsLayerTreeGr
groupAtoms.append( atom );
}
}
atoms.append( groupAtoms );

if ( hasSubItems ) //leave away groups without content
{
atoms.append( groupAtoms );
}

}
else if ( QgsLayerTree::isLayer( node ) )
{
Expand Down

1 comment on commit c783475

@nyalldawson
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test updates are underway

Please sign in to comment.