The QgslegendInterface implementation manages only top level items #217
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I need to create a groups/layers hierarchy starting from a third-party xml file. The QgslegendInterface implementation is limited to manage only top level item. I've no chance to create sub groups other than inside a top level group or add a layer into a sub-group.
The groupIndex/parentIndex used by the members of QgslegendInterface is used as an item index to top level items in the legend. So far the following members are limited to work only with top level items:
I've modified the previous members in the way the groupIndex is a true index to all group hierarchy. Now the groupIndex values are in range 0 to len(QgslegendInterface.groups()).
Furthermore it would be usefull a moveLayer/moveGroup member to move a layer/group after or before another layer/group. In this way it would be possible to create a new project with an exact groups/layers hierarchy or integrate an existing project with a fragment o groups/layers hierarchy.