You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initially my project only has an empty group-layer. When I run the above, mLayer is placed beside that group-layer - OK. However once I delete myLayer and execute the code again, the new layer is added into the group-layer.
I was able to circumvent this by setting the addToLegend-pparameter to False and call QgsProject.instance().layerTreeRoot().insertChildNode(-1, QgsLayerTreeLayer(layer)) myself, which seems to fix it. However it seems counter-intuitive to me, wha addmaplayer should behave that way.
What is the bug or the crash?
I have created a new layer from a json-file and added it to my project like this:
Initially my project only has an empty group-layer. When I run the above,
mLayer
is placed beside that group-layer - OK. However once I deletemyLayer
and execute the code again, the new layer is added into the group-layer.I was able to circumvent this by setting the
addToLegend
-pparameter toFalse
and callQgsProject.instance().layerTreeRoot().insertChildNode(-1, QgsLayerTreeLayer(layer))
myself, which seems to fix it. However it seems counter-intuitive to me, whaaddmaplayer
should behave that way.Steps to reproduce the issue
Versions
QGIS-Version
3.34.11-Prizren
QGIS-Codeversion
2904bce
Qt-Version
5.15.13
Python-Version
3.12.6
GDAL-Version
3.9.2
PROJ-Version
9.4.0
EPSG-Registraturdatenbankversion
v11.004 (2024-02-24)
GEOS-Version
3.12.2-CAPI-1.18.2
SQLite-Version
3.45.1
PDAL-Version
2.6.3
PostgreSQL-Client-Version
16.2
SpatiaLite-Version
5.1.0
QWT-Version
6.2.0
QScintilla2-Version
2.14.1
BS-Version
Windows 10 Version 2009
Aktive Python-Erweiterungen
pluginbuilder3
3.2.1
plugin_reloader
0.17
db_manager
0.1.20
grassprovider
2.12.99
MetaSearch
0.3.6
processing
2.12.99
streckenlocator
1.2
Supported QGIS version
New profile
Additional context
No response
The text was updated successfully, but these errors were encountered: