Feature request #3263
QgsLegendInterface.addGroup() nests all groups
|Pull Request or Patch supplied:||Resolution:||fixed|
|Easy fix?:||No||Copied to github as #:||13323|
The following code adds four groups to the legend. Unfortunately they're all nested while the goal would be to put them into legend root:
i = qgis.utils.iface l = i.legendInterface() groupAnnotation = l.addGroup("Annotation",False) groupDimensioning = l.addGroup("Dimensioning", True) groupLocation = l.addGroup("Location", True) groupTopo = l.addGroup("Topo", True)
#1 Updated by Marco Bernasocchi over 9 years ago
I m dealing with the same problem in my multiview plugin (https://issues.qgis.org/projects/multiview/repository/revisions/master/entry/temporalrasterloaderdialog.py) and i noticed that if i create a group and then load a layer the groups get created at the end of the list (look for the hack in the link). So maybe it is a more complex issue/bug.
#12 Updated by Marco Bernasocchi over 9 years ago
Replying to [comment:13 mhugent]:
Yes, all these group functions with int indices come frome the pre-multiple nesting time. It would probably be better to do a bit of interface redesign for both QgsLegend and QgsLegendInterface after 1.7 (maybe working with QTreeWidgetItems)
True, once done with my master we can have a look at it. will you still apply the patch?