Bug report #16795

Updated by Harrissou Santanna about 6 years ago

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

Back