[Qgis-developer] Create groups in python plugins

Martin Dobias wonder.sk at gmail.com
Tue Dec 1 05:05:59 EST 2009


On Mon, Nov 30, 2009 at 1:55 PM, Andres Manz <manz.andres at gmail.com> wrote:
> 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.)

I think this problem can be avoided by emitting signals when there are
any reorders, stating old and new indices...


>> 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.

But it would be good to avoid usage of QTreeWidgetItem instances so
that we could seamlessly move to model/view implementation...


Bye
Martin


More information about the Qgis-developer mailing list