Skip to content

Remember layer group collapsed/expanded state per project#706

Merged
rldhont merged 3 commits into3liz:masterfrom
meyerlor:feature/remember-group-states
Feb 23, 2026
Merged

Remember layer group collapsed/expanded state per project#706
rldhont merged 3 commits into3liz:masterfrom
meyerlor:feature/remember-group-states

Conversation

@meyerlor
Copy link
Collaborator

Persist the expanded/collapsed state of group items in the layer tree across dialog sessions using QgsSettings, keyed by a hash of the project file path.

  • On tree repopulation, groups default to fully expanded, then saved states are applied
  • State is saved on any manual expand/collapse
  • A guard flag prevents programmatic changes (during populate or active search filter) from overwriting saved state
  • Clearing the search filter restores saved states
  • No changes to the .cfg file

Use QgsSettings to persist expanded/collapsed state of group items
in the layer tree across dialog sessions, keyed by project path hash.
State is restored on tree repopulation and after clearing a search
filter. Programmatic expand/collapse (during populate or search) is
guarded by a flag to avoid overwriting saved state.
@rldhont rldhont merged commit 317da3f into 3liz:master Feb 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants