Bug report #11641

QgsComposerLegend.setLegendFilterByMapEnabled does not work for non-visible raster layers

Added by Patrick Maslen Maslen over 9 years ago. Updated about 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Map Composer/Printing
Affected QGIS version:2.6.0 Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:19894

Description

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.

Thanks

Pat

History

#1 Updated by Jürgen Fischer almost 9 years ago

  • Category set to Map Composer/Printing

#2 Updated by Giovanni Manghi over 8 years ago

  • Target version deleted (Version 2.6)

#3 Updated by Giovanni Manghi almost 7 years ago

  • Easy fix? set to No
  • Regression? set to No

#4 Updated by Arnaud Morvan almost 7 years ago

  • Description updated (diff)
  • Pull Request or Patch supplied changed from No to Yes
  • Status changed from Open to In Progress

Related with #14194
Pull request proposed on master : https://github.com/qgis/QGIS/pull/4531

#5 Updated by Giovanni Manghi about 5 years ago

  • Resolution set to end of life
  • Status changed from In Progress to Closed

Also available in: Atom PDF