Feature request #17459
Being able to customize layer names based on applied style
|Pull Request or Patch supplied:
|Copied to github as #:
I couldn't find if this had already been requested but it's something i've been looking for a long time...
With the possibility to assign different styles to a single layer, I often use a single occurrence of a datasource in my project and, combining styles and map themes, I can create different maps from few layers and switch back and forth in (almost) one click.
The issue resides in the fact that either in the Layer tree or when creating a legend in print composer, the layer name does not correspond in most of the time to the active symbology.
For example, let's take a layer named "city" with fields like "region" and "status". Create and save a categorized style for each field. Note that in the layer tree, whatever style is active, they share the same layer title ("city" if not renamed), though not representing same thing.
Expanding the layer in the tree helps to figure out the active symbology, but it could help to be able to show a title that refers to the current symbology. Not being able to customize the layer name according to the style also adds an extra work when it comes to legend in the print composer: you'd need to break the automatic legend and rename the layer to match what is represented in the map you are showing. Being able to set the name earlier in layer properties would be handier.
I can imagine this as a parameter of the style: we already have the style name (default or whatever) and now add a more presentable and legend-compatible label ("Status of the city" e.g.), set for example in the layer styling panel --> Style manager tab. Or it could be a title in the Symbology tab.
Should it replace the layer name in the layers panel or added in a new line below? I'd favor replacement but no strong opinion.