Fwd: [Qgis-developer] Create groups in python plugins

Andres Manz manz.andres at gmail.com
Mon Nov 30 07:55:03 EST 2009


Hi Martin,

At the beginning I used indices (from the QTreeWidget) instead of
strings, but there was one major problem:
When the scripter adds a group and the user moved that group, it got a
new index. But the scripter had still the old (now incorrect) index. I
could not find an intuitive way to handle that up to now. (I thought
about pointers or references for the index here.)

> moveLayer( ... ) ... should be enough flexible to allow ordering also
> within groups, moving out of groups, maybe even moving of groups?

Yes, this flexibility would be great and I thought about it, too. But
- using indices - you would have to know the index of the layer, the
group or the top element (for moving out of groups). I'll take a look
at QTreeWidget for it. It would be nice to have somthing like a
moveItem( QTreeWidgetItem * ) function, but then we would replace the
indices with QTreeWidgetItems and the scripter could do anything to
the tree.

> removeGroup ( int groupIndex ) ... one thing to consider is whether
> all layers within the group should be removed too or not...

I oriented toward legendGroupRemove() in QgsLegend, which removes the
layers, too.

> One last note - we're going to enter feature freeze very soon, so if
> you want the changes to appear in 1.4 release, you should be
> quick :-)

I don't think the additional functionality will make it into that
release, but I'll give it a try and put as much of functionality as
possible into the patch and upload it. :-)

Regards
Andres


More information about the Qgis-developer mailing list