Opened 13 years ago
Closed 13 years ago
#3263 closed patch (fixed)
QgsLegendInterface.addGroup() nests all groups
Reported by: | anitagraser | Owned by: | mhugent |
---|---|---|---|
Priority: | major: does not work as expected | Milestone: | Version 1.7.0 |
Component: | Map Legend | Version: | Trunk |
Keywords: | Cc: | ||
Must Fix for Release: | No | Platform: | All |
Platform Version: | Awaiting user input: | no |
Description
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)
Attachments (5)
Change History (20)
comment:1 by , 13 years ago
Priority: | minor: annoyance → major: does not work as expected |
---|
comment:2 by , 13 years ago
Type: | bug → patch |
---|
comment:3 by , 13 years ago
Owner: | changed from | to
---|
by , 13 years ago
Attachment: | bug3263fix.diff added |
---|
Better fix, instead of forcing the element to be at the end, addGroup can receive a parent object. The new method addGroupToCurrentItem adds a new goup to the currentItem
comment:5 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I believe it can be closed now.
comment:6 by , 13 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:8 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:9 by , 13 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
the patch applied was an incomplete one... missunderstanding between Marcos :) here the patch to the patch
ciao
comment:10 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Applied in r15766 with two small modifications: -added missing return statement in addGroupToCurrentItem() -removed debug msg
by , 13 years ago
Attachment: | addGroupNestingPython.diff added |
---|
This patch creates the python binding to addGroup. For the moment it allows only one level of nesting like removeGroup
comment:12 by , 13 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
added python bindings. it supports only nesting into a top level element like removeGroup. we should think of a more flexible solution.
follow-up: 14 comment:13 by , 13 years ago
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)
comment:14 by , 13 years ago
Replying to 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?
I m dealing with the same problem in my multiview plugin (http://hub.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.