Skip to content

Commit

Permalink
[composer] ComposerLegend update all now only applies to referenced m…
Browse files Browse the repository at this point in the history
…ap's layers (in case they are locked) (fix #7177)
  • Loading branch information
olivierdalang authored and nyalldawson committed Jan 27, 2014
1 parent cac7790 commit 177e5a1
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/app/composer/qgscomposerlegendwidget.cpp
Expand Up @@ -888,16 +888,27 @@ void QgsComposerLegendWidget::updateLegend()

//get layer id list
QStringList layerIdList;
QgsMapCanvas* canvas = app->mapCanvas();
if ( canvas )
const QgsComposerMap* linkedMap = mLegend->composerMap();
if ( linkedMap && linkedMap->keepLayerSet() )
{
QgsMapRenderer* renderer = canvas->mapRenderer();
if ( renderer )
//if there is a linked map, and if that linked map has a locked layer set, we take the layerIdList from that ComposerMap
layerIdList = linkedMap->layerSet();
}
else
{
//we take the layerIdList from the Canvas
QgsMapCanvas* canvas = app->mapCanvas();
if ( canvas )
{
layerIdList = renderer->layerSet();
QgsMapRenderer* renderer = canvas->mapRenderer();
if ( renderer )
{
layerIdList = renderer->layerSet();
}
}
}


//and also group info
QgsAppLegendInterface legendIface( app->legend() );
QList< GroupLayerInfo > groupInfo = legendIface.groupLayerRelationship();
Expand Down

0 comments on commit 177e5a1

Please sign in to comment.