@@ -655,6 +655,18 @@ QgsLegendGroup* QgsLegend::addEmbeddedGroup( const QString& groupName, const QSt
655
655
return 0 ;
656
656
}
657
657
658
+ // store identify disabled layers of the embedded project
659
+ QSet<QString> embeddedIdentifyDisabledLayers;
660
+ QDomElement disabledLayersElem = projectDocument.documentElement ().firstChildElement ( " properties" ).firstChildElement ( " Identify" ).firstChildElement ( " disabledLayers" );
661
+ if ( !disabledLayersElem.isNull () )
662
+ {
663
+ QDomNodeList valueList = disabledLayersElem.elementsByTagName ( " value" );
664
+ for ( int i = 0 ; i < valueList.size (); ++i )
665
+ {
666
+ embeddedIdentifyDisabledLayers.insert ( valueList.at ( i ).toElement ().text () );
667
+ }
668
+ }
669
+
658
670
QDomElement legendElem = projectDocument.documentElement ().firstChildElement ( " legend" );
659
671
if ( legendElem.isNull () )
660
672
{
@@ -719,10 +731,18 @@ QgsLegendGroup* QgsLegend::addEmbeddedGroup( const QString& groupName, const QSt
719
731
group->insertChild ( group->childCount (), cItem );
720
732
}
721
733
722
- if ( !visible )
734
+ if ( !visible )
723
735
{
724
736
cItem->setCheckState ( 0 , Qt::Unchecked );
725
737
}
738
+
739
+ // consider the layer might be identify disabled in its project
740
+ if ( embeddedIdentifyDisabledLayers.contains ( layerId ) )
741
+ {
742
+ QStringList thisProjectIdentifyDisabledLayers = QgsProject::instance ()->readListEntry ( " Identify" , " /disabledLayers" );
743
+ thisProjectIdentifyDisabledLayers.append ( layerId );
744
+ QgsProject::instance ()->writeEntry ( " Identify" , " /disabledLayers" , thisProjectIdentifyDisabledLayers );
745
+ }
726
746
}
727
747
else if ( tagName == " legendgroup" )
728
748
{
0 commit comments