@@ -162,28 +162,31 @@ QList<QgsLegendRenderer::Atom> QgsLegendRenderer::createAtomList( QgsLayerTreeGr
162162 // Group subitems
163163 QList<Atom> groupAtoms = createAtomList ( nodeGroup, splitLayer );
164164
165- Nucleon nucleon;
166- nucleon.item = node;
167- nucleon.size = drawGroupTitle ( nodeGroup );
168-
169- if ( groupAtoms.size () > 0 )
170- {
171- // Add internal space between this group title and the next nucleon
172- groupAtoms[0 ].size .rheight () += spaceAboveAtom ( groupAtoms[0 ] );
173- // Prepend this group title to the first atom
174- groupAtoms[0 ].nucleons .prepend ( nucleon );
175- groupAtoms[0 ].size .rheight () += nucleon.size .height ();
176- groupAtoms[0 ].size .rwidth () = qMax ( nucleon.size .width (), groupAtoms[0 ].size .width () );
177- }
178- else
165+ if ( nodeLegendStyle ( nodeGroup ) != QgsComposerLegendStyle::Hidden )
179166 {
180- // no subitems, append new atom
181- Atom atom;
182- atom.nucleons .append ( nucleon );
183- atom.size .rwidth () += nucleon.size .width ();
184- atom.size .rheight () += nucleon.size .height ();
185- atom.size .rwidth () = qMax ( nucleon.size .width (), atom.size .width () );
186- groupAtoms.append ( atom );
167+ Nucleon nucleon;
168+ nucleon.item = node;
169+ nucleon.size = drawGroupTitle ( nodeGroup );
170+
171+ if ( groupAtoms.size () > 0 )
172+ {
173+ // Add internal space between this group title and the next nucleon
174+ groupAtoms[0 ].size .rheight () += spaceAboveAtom ( groupAtoms[0 ] );
175+ // Prepend this group title to the first atom
176+ groupAtoms[0 ].nucleons .prepend ( nucleon );
177+ groupAtoms[0 ].size .rheight () += nucleon.size .height ();
178+ groupAtoms[0 ].size .rwidth () = qMax ( nucleon.size .width (), groupAtoms[0 ].size .width () );
179+ }
180+ else
181+ {
182+ // no subitems, append new atom
183+ Atom atom;
184+ atom.nucleons .append ( nucleon );
185+ atom.size .rwidth () += nucleon.size .width ();
186+ atom.size .rheight () += nucleon.size .height ();
187+ atom.size .rwidth () = qMax ( nucleon.size .width (), atom.size .width () );
188+ groupAtoms.append ( atom );
189+ }
187190 }
188191 atoms.append ( groupAtoms );
189192 }
0 commit comments