I want to know if there is signals in layers tree to get notified when the active layer changed or more precisely when the user clicks or dbl click on any layer or node in the layers tree view.
I search in QGIS documentation but found nothing!
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
I have the solution after playing around here in the related questions to my question:
def test(lyr): print(lyr.id()) iface.legendInterface().currentLayerChanged.connect(test)
the sample code above is not perfect but showing the solution, the signal
currentLayerChanged fires every time the user changes the selected node or item (layer) in the layers treeview.