This question already has an answer here:

I have saved a style as qml file. I try to set the style for a raster layer in python directly. For this, I use function "loadNamedStyle". After the call, the color themes are updated in my model but the description text under the raster layer is still not updated. My question, how can I refresh the information?

enter image description here

marked as duplicate by Community Apr 18 '18 at 14:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


This solution helped me. My problem is solved.

iface.layerTreeView().refreshLayerSymbology( iface.activeLayer().id() )

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