Bug report #11576

Composer legend not responding to pyqgis commands

Added by Patrick Maslen Maslen about 10 years ago. Updated over 9 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:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:19838

Description

I am working on a plugin which among other things produces maps based on a series of map templates, each one with a main map and an overview map. Each template also has a legend which is intended to be linked to the main map. The plugin is designed to enable non-expert users to create well laid out maps.

In QGIS 2.2 and 2.4, the following pyqgis code worked as expected, ensuring the legend lists each layer in the canvas at that time:

mainMap.storeCurrentLayerSet()
mainMap.setKeepLayerSet(True)
legend.setComposerMap(mainMap)
legend.updateLegend()

Later in the code I change the set of layers so that I can store a different layer set for the overview map.

Using the same code in QGIS 2.6, the legend does not have any layers listed. Many of the target users will be put off by having to manipulate the legend themselves.

Thanks

Pat

History

#1 Updated by Giovanni Manghi about 10 years ago

  • Status changed from Open to Feedback
  • Category set to Map Composer/Printing

Legend in composer has also been subject of several developments in qgis 2.6, so probably something must change in your code. Seems more appropriate for a question on the developers mailing list rather than classifying this as a bug.

#2 Updated by Giovanni Manghi over 9 years ago

  • Resolution set to invalid
  • Status changed from Feedback to Closed

closing for lack of feedback.

Also available in: Atom PDF