File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -888,16 +888,27 @@ void QgsComposerLegendWidget::updateLegend()
888
888
889
889
// get layer id list
890
890
QStringList layerIdList;
891
- QgsMapCanvas* canvas = app-> mapCanvas ();
892
- if ( canvas )
891
+ const QgsComposerMap* linkedMap = mLegend -> composerMap ();
892
+ if ( linkedMap && linkedMap-> keepLayerSet () )
893
893
{
894
- QgsMapRenderer* renderer = canvas->mapRenderer ();
895
- if ( renderer )
894
+ // if there is a linked map, and if that linked map has a locked layer set, we take the layerIdList from that ComposerMap
895
+ layerIdList = linkedMap->layerSet ();
896
+ }
897
+ else
898
+ {
899
+ // we take the layerIdList from the Canvas
900
+ QgsMapCanvas* canvas = app->mapCanvas ();
901
+ if ( canvas )
896
902
{
897
- layerIdList = renderer->layerSet ();
903
+ QgsMapRenderer* renderer = canvas->mapRenderer ();
904
+ if ( renderer )
905
+ {
906
+ layerIdList = renderer->layerSet ();
907
+ }
898
908
}
899
909
}
900
910
911
+
901
912
// and also group info
902
913
QgsAppLegendInterface legendIface ( app->legend () );
903
914
QList< GroupLayerInfo > groupInfo = legendIface.groupLayerRelationship ();
You can’t perform that action at this time.
0 commit comments