1

I would like add one group into another (already existing one) in layerTreeRoot using PyQGIS.

How can i do it?

Adding layer group using PyQGIS? is not the answer to my question, because it allows only to create 2 groups at the same time. Group and sub group.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Kocark284
  • 11
  • 2
  • 1
    Use steps 1 and 2 of this answer (https://gis.stackexchange.com/questions/75384/add-layer-to-a-qgis-group-using-python/126587#126587) to get the group (let's call it myOriginalGroup) where you want to place your new group. Then just use a myNewGroup = myOriginalGroup.addGroup("My New Group") and you're done. See also this answer (https://gis.stackexchange.com/questions/66169/adding-layer-group-using-pyqgis/134377#134377) for reference, namely where I mention nested groups. – Germán Carrillo Oct 28 '19 at 13:07

0 Answers0