Skip to content

Bugfix/hide private layers from dropdown#4600

Open
xkello wants to merge 2 commits into
masterfrom
bugfix/hide-private-layers-from-dropdown
Open

Bugfix/hide private layers from dropdown#4600
xkello wants to merge 2 commits into
masterfrom
bugfix/hide-private-layers-from-dropdown

Conversation

@xkello

@xkello xkello commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Description

Layers set to private in QGIS were still visible in the add feature layer dropdown, which was inconsistent with the Layers tab, where private layers are correctly hidden.

Fixes: #4486

Problem

Users could still record new features on layers marked as private. This caused issues for admins who wanted to restrict users to adding features only as children of parent features, since the private-layer restriction was effectively bypassed in the recording flow.

What changed

  1. Added a check in recordinglayersproxymodel - bool isPrivate = layer->flags() & QgsMapLayer::LayerFlag::Private - for each layer. The app now checks whether a layer is private and excludes it from the dropdown if so.
  2. Added the same guard to activeproject's recordingAllowed. Even though the dropdown itself was filtering correctly, the app still fetched all layers on init - meaning a private layer could still be auto-selected as the active layer if it was the only layer present, or if it happened to be first in the layer list.

Behaviour

On startup, the app now filters out private layers when iterating through available layers. When the add button is tapped, private layers no longer appear in the dropdown, matching the behavior of the Layers tab. If no eligible layers remain after filtering, the app shows the existing "No editable layers found" message.

@xkello xkello added this to the 2026.4.0 milestone Jul 14, 2026
@xkello
xkello requested a review from Withalion July 14, 2026 15:10
@github-actions

Copy link
Copy Markdown

📦 Build Artifacts Ready

OS Status Build Info Workflow run
macOS Build 📬 Mergin Maps 70251 dmg Expires: 12/10/2026 #7025
linux Build Build failed or not found. #7051
win64 Build 📬 Mergin Maps 62271 win64 Expires: 12/10/2026 #6227
Android Build 📬 Mergin Maps 833551 APK [arm64-v8a] Expires: 12/10/2026 #8335
📬 Mergin Maps 833551 APK [arm64-v8a] Google Play Store #8335
Android Build 📬 Mergin Maps 833511 APK [armeabi-v7a] Expires: 12/10/2026 #8335
📬 Mergin Maps 833511 APK [armeabi-v7a] Google Play Store #8335
iOS Build 📬 Build number: 26.07.927711 #9277

1 similar comment
@github-actions

Copy link
Copy Markdown

📦 Build Artifacts Ready

OS Status Build Info Workflow run
macOS Build 📬 Mergin Maps 70251 dmg Expires: 12/10/2026 #7025
linux Build Build failed or not found. #7051
win64 Build 📬 Mergin Maps 62271 win64 Expires: 12/10/2026 #6227
Android Build 📬 Mergin Maps 833551 APK [arm64-v8a] Expires: 12/10/2026 #8335
📬 Mergin Maps 833551 APK [arm64-v8a] Google Play Store #8335
Android Build 📬 Mergin Maps 833511 APK [armeabi-v7a] Expires: 12/10/2026 #8335
📬 Mergin Maps 833511 APK [armeabi-v7a] Google Play Store #8335
iOS Build 📬 Build number: 26.07.927711 #9277

@Withalion Withalion removed this from the 2026.4.0 milestone Jul 16, 2026

@Withalion Withalion left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After checking the QFlags API I would recommend using testFlag function instead of the and operator

Please rebase on current master as well

Comment thread app/activeproject.cpp
if ( layer->readOnly() )
return false;

if ( layer )

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this condition is always true

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.

Hide private layers from 'Add' list

2 participants