[QGIS-Developer] repaint layertree/legend

Richard Duivenvoorde rdmailings at duif.net
Mon Oct 19 05:31:34 PDT 2020


On 10/19/20 2:19 PM, Salvatore Larosa wrote:
> Hi Richard,
> 
> there is a refreshLayerLegend(QgsLayerTreeLayer) method which
> refreshes the layer node.
> That should show up the temporal indicator after activating.

Cool, yes, works!

node = QgsProject.instance().layerTreeRoot().findLayer(l) # find QgsLayerTreeLayer in QgsLayerTree
# could do some checking here :-)
iface.layerTreeView().model().refreshLayerLegend(node)

Thanks!

Richard


More information about the QGIS-Developer mailing list