Bug report #13575

"Add a Legend" adds ALL the layers in the project instead of just the visible or locked ones

Added by Harrissou Santanna about 9 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Map Composer/Printing
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

Description

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).


Related issues

Related to QGIS Application - Feature request #12969: Autohide empty groups and sub-groups in "Filtered" Map Co... Closed 2015-06-15
Related to QGIS Application - Bug report #11293: Auto update Shows All Layers Closed 2014-09-29

History

#1 Updated by Nyall Dawson about 9 years ago

  • Priority changed from Severe/Regression to Normal

Not a regression or broken new feature, so not a blocker

#2 Updated by Harrissou Santanna about 9 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.

#3 Updated by Nyall Dawson about 9 years ago

High is used for issues which cause data loss or crashes, so normal is the right priority. I agree though that the described behavior would be a big improvement.

#4 Updated by Martin Dobias over 8 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...

#5 Updated by Giovanni Manghi over 7 years ago

  • Regression? set to No
  • Easy fix? set to No

#6 Updated by Giovanni Manghi over 5 years ago

  • Resolution set to end of life
  • Status changed from Open to Closed

Also available in: Atom PDF