[Qgis-developer] index in self.legend.groupLayerRelationship - different behavior between QGIS 1.8 and master?

Etienne Tourigny etourigny.dev at gmail.com
Tue Sep 25 13:16:51 PDT 2012


Hi,

legend management is in need of a review, quite a few things are
missing... would be nice to create QMap structures to be able to
access everything from python.

cheers
Etienne

On Tue, Sep 25, 2012 at 5:01 PM, Andreas Neumann <a.neumann at carto.net> wrote:
> hm - maybe a side effect of this patch? Currently, there is a shift in
> the index whereas QGIS master returns an invalid index and QGIS 1.8
> returns the correct index.
>
> I could work around it by detecting if it is QGIS 1.9 and substract 1
> from the index, but it would be awkward.
>
> Alternatively it would be nice to have a method for direct access to
> groups by name, without having to loop through all groups and see if the
> name matches ...
>
> I can report a bug on this.
>
> Andreas
>
> Am 25.09.2012 18:22, schrieb Marco Bernasocchi:
>> hi Andy,
>> IIRC there was a mail about somebody working there to give more control.
>> just looked up, it was endmax. see [1]
>> ciao
>>
>> (1)
>> https://github.com/qgis/Quantum-GIS/commit/318dd7c16ba0686a02f0ae981d5c380d79466d16#src/app/legend/qgsapplegendinterface.cpp
>>
>> Marco Bernasocchi (mobile)
>> http://opengis.ch
>> On Sep 25, 2012 11:06 PM, "Andreas Neumann" <a.neumann at carto.net> wrote:
>>
>>> Hi,
>>>
>>> When testing a self-written plugin, I noticed a different behavior between
>>> QGIS 1.8 and master.
>>>
>>> I used the following code to move a layer into a certain group which I
>>> detected by name:
>>>
>>> here is the code:
>>>
>>>         groups = []
>>>         for group in self.legend.**groupLayerRelationship():
>>>                 groups.append(group[0])
>>>         groupIndex = groups.index(groupName)
>>>         #move new layer to existing group
>>>         self.legend.moveLayer(**schuelerLayer, groupIndex)
>>>
>>> While this works fine in QGIS 1.8, in QGIS master it is shifted to one
>>> group below the correct group. Did some behavior of the groupIndex change?
>>>
>>> Thanks,
>>> Andreas
>>>
>>> --
>>> --
>>> Andreas Neumann
>>> Böschacherstrasse 10A
>>> 8624 Grüt (Gossau ZH)
>>> Switzerland
>>> ______________________________**_________________
>>> Qgis-developer mailing list
>>> Qgis-developer at lists.osgeo.org
>>> http://lists.osgeo.org/**mailman/listinfo/qgis-**developer<http://lists.osgeo.org/mailman/listinfo/qgis-developer>
>>>
>>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the Qgis-developer mailing list