Skip to content
Permalink
Browse files
Consider identify disabled layers in embedded projects
  • Loading branch information
marco committed Aug 9, 2011
1 parent 43e8321 commit 2a9aabb832ee0bf9eb5658333753bbc64f6b9a9d
Showing with 21 additions and 1 deletion.
  1. +21 −1 src/app/legend/qgslegend.cpp
@@ -655,6 +655,18 @@ QgsLegendGroup* QgsLegend::addEmbeddedGroup( const QString& groupName, const QSt
return 0;
}

//store identify disabled layers of the embedded project
QSet<QString> embeddedIdentifyDisabledLayers;
QDomElement disabledLayersElem = projectDocument.documentElement().firstChildElement( "properties" ).firstChildElement( "Identify" ).firstChildElement( "disabledLayers" );
if ( !disabledLayersElem.isNull() )
{
QDomNodeList valueList = disabledLayersElem.elementsByTagName( "value" );
for ( int i = 0; i < valueList.size(); ++i )
{
embeddedIdentifyDisabledLayers.insert( valueList.at( i ).toElement().text() );
}
}

QDomElement legendElem = projectDocument.documentElement().firstChildElement( "legend" );
if ( legendElem.isNull() )
{
@@ -719,10 +731,18 @@ QgsLegendGroup* QgsLegend::addEmbeddedGroup( const QString& groupName, const QSt
group->insertChild( group->childCount(), cItem );
}

if( !visible )
if ( !visible )
{
cItem->setCheckState( 0, Qt::Unchecked );
}

//consider the layer might be identify disabled in its project
if ( embeddedIdentifyDisabledLayers.contains( layerId ) )
{
QStringList thisProjectIdentifyDisabledLayers = QgsProject::instance()->readListEntry( "Identify", "/disabledLayers" );
thisProjectIdentifyDisabledLayers.append( layerId );
QgsProject::instance()->writeEntry( "Identify", "/disabledLayers", thisProjectIdentifyDisabledLayers );
}
}
else if ( tagName == "legendgroup" )
{

0 comments on commit 2a9aabb

Please sign in to comment.