Ok, I eventually solved my problem. In case others would face the same problem, use "iface.legendInterface().layers()" instead of "iface.mapCanvas().layers()", the latter only providing already selected layers. Benoît