[QGIS-Developer] How to turn on CustomLayerOrder (PyQGIS)
coder
coder at odyhpc.com
Wed Oct 23 08:04:52 PDT 2024
Hello
I'm trying to change the rendering order for the layers in the canvas with
the aid of QgsLayerTree. The code grabs each layer, checks whether is a
QgsMapLayer instance, and generates a reordered list (layersII). Then, the
code executes:
QgsLayerTree().setCustomLayerOrder(layersII)
but nothing happens and
print (QgsLayerTree().hasCustomLayerOrder())
returns False. The API documentation
(https://qgis.org/pyqgis/master/core/QgsLayerTree.html) indicates that
customLayerOrder will only be used when hasCustomLayerOrder is True. I'm
missing something here but after browsing and googling, I just haven't
figured out how to make the change in rendering order active. Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20241023/4132b186/attachment.htm>
More information about the QGIS-Developer
mailing list