Skip to content

Commit

Permalink
Set visibility of layers for embedded groups (ticket #4097)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Jul 21, 2011
1 parent 7eed4b9 commit d02c4be
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/app/legend/qgslegend.cpp
Expand Up @@ -697,6 +697,7 @@ QgsLegendGroup* QgsLegend::addEmbeddedGroup( const QString& groupName, const QSt
for ( int j = 0; j < groupChildren.size(); ++j )
{
QDomElement childElem = groupChildren.at( j ).toElement();
bool visible = ( childElem.attribute( "checked" ).compare( "Qt::Checked", Qt::CaseInsensitive ) == 0 );
QString tagName = childElem.tagName();
if ( tagName == "legendlayer" )
{
Expand All @@ -717,6 +718,11 @@ QgsLegendGroup* QgsLegend::addEmbeddedGroup( const QString& groupName, const QSt
{
group->insertChild( group->childCount(), cItem );
}

if( !visible )
{
cItem->setCheckState( 0, Qt::Unchecked );
}
}
else if ( tagName == "legendgroup" )
{
Expand Down Expand Up @@ -1175,6 +1181,7 @@ bool QgsLegend::readXML( QgsLegendGroup *parent, const QDomNode &node )
if ( childelem.attribute( "embedded" ) == "1" )
{
theGroup = addEmbeddedGroup( name, QgsProject::instance()->readPath( childelem.attribute( "project" ) ) );
updateGroupCheckStates( theGroup );
}
else
{
Expand Down

0 comments on commit d02c4be

Please sign in to comment.