Skip to content

resolve layers from IDs to avoid QObject selectedFeatures error (#24)#30

Merged
antoniolocandro merged 1 commit intoFLYGHT7:mainfrom
andures:feature/24-layer-id-resolve
Mar 30, 2026
Merged

resolve layers from IDs to avoid QObject selectedFeatures error (#24)#30
antoniolocandro merged 1 commit intoFLYGHT7:mainfrom
andures:feature/24-layer-id-resolve

Conversation

@andures
Copy link
Copy Markdown
Collaborator

@andures andures commented Dec 19, 2025

Fixes a crash where selectedFeatures() was called on a PyQt QObject wrapper instead of a QgsVectorLayer.
Root cause: storing layer objects in combo currentData() can yield wrappers in QGIS 3.44; calling layer APIs then fails.
Changes

Store layer IDs in combos and resolve real layers via project:
ils_llz_dockwidget.py
refresh_layers(): addItem(name, layer.id())
_apply_facility_defaults(): resolve with QgsProject.instance().mapLayer(id) before using selectedFeatures()
get_parameters(): resolve IDs to QgsVectorLayer via QgsProject.instance().mapLayer(...)
Behavior
Closes #24

@antoniolocandro antoniolocandro merged commit 2b9dd56 into FLYGHT7:main Mar 30, 2026
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.

Following issue raised

2 participants