Bug report #11641

Updated by Arnaud Morvan almost 6 years ago

When a raster layer is loaded but visibility set to False (e.g. because a composer has a main map and an overview map, with the raster layer being required only for the overview map), QgsComposerLegend.setLegendFilterByMapEnabled(True) does not result in the raster layer being removed from the composer legend. Vector layers behave as expected - i.e. they are removed from the legend when the same process is applied. I understand that the method is also for limiting legend entries for vectors displayed with categorised styles, but I need a way to programmatically remove raster layers from the composer legend.

This is important for my organisation's several hundred QGIS users, most of them not highly skilled, as we create an automated map production Python plugin based on templates using a specific raster layer in the overview maps. The combination of this issue with part 2 of bug report #11293 means that I have not been able to use pyqgis to remove the raster layer from the composer legends - this may well mean we choose 2.4 rather than 2.6 for our imminent upgrade from 1.8.