Bug report #13575
"Add a Legend" adds ALL the layers in the project instead of just the visible or locked ones
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||end of life|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||21617|
Most of the times, when you add legend to a map, it's about features that are shown in it. You only care about layers that are displayed or the ones that should be displayed. But in QGIS last releases, "Add a legend" tool adds ALL the layers in the project, without considering if they are visible or not, if they cover the map item extent or not.
Adding a legend in a big project means therefore that you have to spend a lot of time removing the unwanted layers and groups. This is really time consuming and imho an umproductive behaviour.
"Filtering legend by the map content" is neither a quick solution considering bug report #12969 or #11293.
There has been a fix for a kind of bug (see #7177), reason why I set this as a regression ( even if it was against 2.4). The best behaviour imho is that when a legend is added, it should :
- list all the visible layers in the map canvas when "lock layers for map item" is unchecked
- list only the locked layers in the map item when "lock layers for map item" is checked
- add group/subgroup structure only for the layers above (#12969)
The Auto-update option, when active, will keep updated these layer's styles or the list of locked layers if changed (using a preset for example).
#2 Updated by Harrissou Santanna over 4 years ago
You may be right Nyall, but i'm not sure this should be set as normal. Combined to the "filtering by map content" issues and the preset issue discussed in #13418, this leads designing (and keeping up to date) a complete composition, despite its nice features, painful imho. it should be set as high.
#4 Updated by Martin Dobias about 4 years ago
I think in order to fix this issue and the related issues, we will need to improve the layer tree model class to support flexible filtering of its items. Currently it only allows filtering of legend items within layers, which is not enough to allow hiding of layer items or group items. Unfortunately this is not feasible to add just before the LTR as the implementation will take a bit of time and there is a high risk of introducing some new bugs.
Anyway, with the advanced filtering, it should be quite straightforward to add nice features like 'quick find' box where the layer tree would get filtered as you type...
#6 Updated by Giovanni Manghi about 1 year ago
- Resolution set to end of life
- Status changed from Open to Closed
End of life notice: QGIS 2.18 LTR