mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
[composer] ComposerLegend update all now only applies to referenced map's layers (in case they are locked) (fix #7177)
This commit is contained in:
parent
cac7790e42
commit
177e5a1952
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user