After running a longer script (Qgis Console), all I want to do is sort the layers within my groups; since some of them are buffers and the 'biggest' buffer is now on top.
I've tried stuff based on: Post on how to sort Layers
And Martin Dobias's post concerning the tree layer api: Layer Tree API 1 ; Layer Tree API 2 ; Layer Tree API 3
It sounds simple enough but for some reason I can not figure it out...
Among many things I've tried this:
root = QgsProject.instance().layerTreeRoot()
for child in root.children():
if isinstance(child, QgsLayerTreeGroup):
lyr = child.children()
lyr.sortItems(0,Qt.AscendingOrder)
But .children() appearantly returns a list(?)
The iface.legendInterface() group-options didn't help either...