Skip to content

Layout Legends - Rework handling of initial layer set and synchronization (Request in QGIS) #10674

@qgis-bot

Description

@qgis-bot

Request for documentation

From pull request qgis/QGIS#64515
Author: @nyalldawson
QGIS version: 4.0

Layout Legends - Rework handling of initial layer set and synchronization

PR Description:

Implements qgis/QGIS-Enhancement-Proposals#253

Introduction of legend layer synchronisation modes

Changes the existing (confusing!!) "Auto update" checkbox for layout legends to a user-friendly combobox showing legend population modes. Options are:

  1. Synchronize to All Project Layers

This option matches the current behaviour of the "Auto sync" checkbox. If selected, then all new layers added to the project will appear immediately in the legend and any changes made to these layers will immediately be applied to the legend.

  1. Synchronize to Visible Layers

This option will consider which layers are currently visible in the map linked to the legend item (or main project layer tree, if no map is linked to the legend). When this mode is active then any changes to the set of layers visible in the map will cause the legend layers to be matched to this set of visible layers.

Note that this mode differs from the existing "Only show items in the linked map" option because the "Synchronize to Visible Layers" mode does not consider the linked map extent at all - if a layer is checked and visible for the map, then it will be shown in the legend regardless of whether or not all features in the layer fall outside the visible map extent.

Like the "Synchronize to All Project Layers" option, any changes made to the names or other legend related settings in the main project layer tree will automatically be propagated to the layout legend.

  1. Manual Layer Selection

All content for the legend can be controlled manually by the user, and no auto-synchronization of which layers are included will apply. This is the same behaviour as currently happens in QGIS if the "auto update" option is unchecked.

New setting for default synchronization mode

A new global setting has been added to the Options - Layout page, allowing users to control the default mode for newly created legends. The default has been set to the new "Synchronize to Visible Layers" mode in order to provide a better out-of-the-box experience for users with large projects. (Users who want can switch the default back to "Synchronize to All Project Layers" if they don't want this new default)

Rework resetting legends

In current QGIS versions accompanying the existing "Auto update" checkbox is a button for "Update All". (This button is DISABLED when the auto-update checkbox is checked, so it can only be clicked when a user is manually controlling the legend content). When clicked, the current legend item customisations are discarded and the legend is reset to contain ALL project layers with their project layer tree naming.

This button has been reworked, and renamed to "Reset". This button is only enabled when the legend synchronization mode is set to "Manual Layer Selection". The intended use case for this button is for a user who is manually customising legend content but needs to do a one-off reset to the project/visible layers state. Clicking it shows a drop-down menu choice with:

  1. Reset to All Project Layers
    Clicking Reset to All Project Layers will discard all the existing legend content and repopulate the legend with every layer from the project.
  2. Reset to Visible Layers
    Clicking Reset to Visible Layers will discard all existing legend content and repopulate only from currently visible layers.

Funded by QGIS Danish User Group

Commits tagged with [need-docs] or [FEATURE]

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions