qgis/QGIS — pull request #1629 by slarosa (2014-10-16 06:50:23+00:00)
Title: LayerTree - keep checkstate of the moved layer

refs: http://hub.qgis.org/issues/11382

the current behavior does not keep the state of the moved layer when you call the ```moveLayer``` method, the layer will always be visible (checked), I think it make more sense to keep the checkstate of the layer when moved to group.

The below snippet does the layer ```vl``` visible altough you call ```setLayerVisible(vl, False)```
```python
vl = iface.activeLayer()
legend = iface.legendInterface()

myGroup = legend.addGroup("myGroup", False)
legend.setLayerVisible(vl, False)
legend.moveLayer(vl, myGroup)
```

with the patch the ```vl``` layer will be unchecked into layer tree.