Skip to content
Permalink
Browse files

Fix #11331 (hidden group still occupies space in composer legend)

  • Loading branch information
wonder-sk committed Oct 20, 2014
1 parent ac5ff27 commit 0c7bc40d65ae6bef285ba69ca9ff9816e59f00b1
Showing with 24 additions and 21 deletions.
  1. +24 −21 src/core/qgslegendrenderer.cpp
@@ -162,28 +162,31 @@ QList<QgsLegendRenderer::Atom> QgsLegendRenderer::createAtomList( QgsLayerTreeGr
// Group subitems
QList<Atom> groupAtoms = createAtomList( nodeGroup, splitLayer );

Nucleon nucleon;
nucleon.item = node;
nucleon.size = drawGroupTitle( nodeGroup );

if ( groupAtoms.size() > 0 )
{
// Add internal space between this group title and the next nucleon
groupAtoms[0].size.rheight() += spaceAboveAtom( groupAtoms[0] );
// Prepend this group title to the first atom
groupAtoms[0].nucleons.prepend( nucleon );
groupAtoms[0].size.rheight() += nucleon.size.height();
groupAtoms[0].size.rwidth() = qMax( nucleon.size.width(), groupAtoms[0].size.width() );
}
else
if ( nodeLegendStyle( nodeGroup ) != QgsComposerLegendStyle::Hidden )
{
// no subitems, append new atom
Atom atom;
atom.nucleons.append( nucleon );
atom.size.rwidth() += nucleon.size.width();
atom.size.rheight() += nucleon.size.height();
atom.size.rwidth() = qMax( nucleon.size.width(), atom.size.width() );
groupAtoms.append( atom );
Nucleon nucleon;
nucleon.item = node;
nucleon.size = drawGroupTitle( nodeGroup );

if ( groupAtoms.size() > 0 )
{
// Add internal space between this group title and the next nucleon
groupAtoms[0].size.rheight() += spaceAboveAtom( groupAtoms[0] );
// Prepend this group title to the first atom
groupAtoms[0].nucleons.prepend( nucleon );
groupAtoms[0].size.rheight() += nucleon.size.height();
groupAtoms[0].size.rwidth() = qMax( nucleon.size.width(), groupAtoms[0].size.width() );
}
else
{
// no subitems, append new atom
Atom atom;
atom.nucleons.append( nucleon );
atom.size.rwidth() += nucleon.size.width();
atom.size.rheight() += nucleon.size.height();
atom.size.rwidth() = qMax( nucleon.size.width(), atom.size.width() );
groupAtoms.append( atom );
}
}
atoms.append( groupAtoms );
}

0 comments on commit 0c7bc40

Please sign in to comment.
You can’t perform that action at this time.