When I change symbology for a given QgsVectorLayer
(QGIS 2.14.16 LTR) by
r=iface.activeLayer().rendererV2()
r.symbol().symbolLayers()[0].setColor(0,0,255,255)
as shown here:
and refreshing the map content by
iface.mapCanvas().refreshAllLayers()
I get the expected result, but the Layer Tree does not update as shown here:
What am I missing, and how can I update the Layer tree from PyQGIS programmatically?
Answer
Tell the layer tree view to refresh your layer's symbology:
iface.layerTreeView().refreshLayerSymbology( iface.activeLayer().id() )
No comments:
Post a Comment