3

i made changes in the render order of my map canvas using a :

qgis.utils.iface.mapCanvas().setLayerSet(a)

"a" being a list of QgsMapCanvasLayer

My code is working as expected (i see result on map canvas) but the "layer render order" widget (dunno the right english name...) is not refreshing ...

How can i programmatically do that ?

Thanks !

1

The canvas does not communicate its state back to the widget.

The layer order is managed by QgsLayerTreeMapCanvasBridge which is only exposed as of (upcoming) QGIS 2.12 and in the nightlies since now.

l = iface.layerTreeCanvasBridge()
l.setCustomLayerOrder(a) # a is a list of layer ids, make sure all the layers are in there
l.setHasCustomLayerOrder(True)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.