Bug report #16795

[Composer Legend] Symbology of layer always follows the map canvas and breaks the composer legend

Added by Harrissou Santanna over 7 years ago. Updated almost 6 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Map Composer/Printing
Affected QGIS version:3.5(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:24694

Description

Create two different styles for a single layer.
Now in print composer, do a layout and add the layer to a composer legend.
Go to the map canvas and activate the other style of the layer. In your composer legend, you'll notice that the layer legend has changed and follows what is shown in the map canvas and not the style you have set at the beginning (which should be in line with your map).
Note that if you switch the map canvas to a preset visibility that contains the layer with the first style, the style is well rendered in the legend.
If you had switched to a preset visibility that doesn't use the layer, no change is done in the legend either.

This state can easily corrupt the legend of the layout unless you check each print composer (actually update map canvas with correct preset visibility) before exporting (to ensure the legend shown is in line with the maps in composer) --> time consuming, prone to error (and discourages to use multiple styles for a single layer).

I think that legend of the layer should be bound to the style it has been added with to the composer, and follow the changes in that style. But it shouldn't switch between styles, according to what's enabled or not in the map canvas.

======================
Ouch! I'm rewording given that the description above is just ununderstandable. Sorry, devs. Let's do it simple :-)

In few words, the symbol shown in a legend item follows the style of the layer in the map canvas and not the styled used in the map item: it uses the style applied to the layer the last time it was visible.

In a project where multiple styles are used for a single layer, this becomes problematic.

Still applies to 2.18 and master 3.1


Related issues

Related to QGIS Application - Bug report #20055: Legend in Print Layout does not follow set map-theme Closed 2018-10-09
Duplicated by QGIS Application - Feature request #19717: Legend to reflect map theme in layouts/ reports Open 2018-08-28
Duplicated by QGIS Application - Bug report #18733: Legend not matching map with "lock style for layers" option Closed 2018-04-17

History

#1 Updated by Harrissou Santanna over 6 years ago

  • Description updated (diff)

#2 Updated by Giovanni Manghi over 6 years ago

  • Affected QGIS version changed from 2.18.10 to 3.1(master)

#3 Updated by Pieter Brusselman over 6 years ago

I have a similar issue using visibility-presets/themes. In the printcomposer you can assign a certain preset/theme to a map. However, the legend does not follow the assigned preset/theme, even if auto update is unchecked. The legend that shows up is the one that is active in the projectwindow.

#4 Updated by Harrissou Santanna almost 6 years ago

  • Related to Bug report #20055: Legend in Print Layout does not follow set map-theme added

#5 Updated by Anita Graser almost 6 years ago

#6 Updated by Anita Graser almost 6 years ago

  • Affected QGIS version changed from 3.1(master) to 3.5(master)

#7 Updated by Jürgen Fischer over 5 years ago

  • Duplicated by Bug report #18733: Legend not matching map with "lock style for layers" option added

Also available in: Atom PDF