[Qgis-developer] Syntax for using QList<QgsMapLayer *> signal in python

Larry Shaffer larrys at dakotacarto.com
Thu Apr 19 13:12:16 EDT 2012


Sorry for extending the confusion. I now understand you were referring to
the layersAdded signal.

Larry



On Thu, Apr 19, 2012 at 11:03 AM, Larry Shaffer <larrys at dakotacarto.com>wrote:

> Hi Tim,
>
> On Thu, Apr 19, 2012 at 3:33 AM, Tim Sutton <lists at linfiniti.com> wrote:
>
>> Hi
>>
>> On Thu, Apr 19, 2012 at 11:28 AM, Tim Sutton <lists at linfiniti.com> wrote:
>> > Hi
>> >
>> > On Thu, Apr 19, 2012 at 11:14 AM, Denis Rouzaud <
>> denis.rouzaud at gmail.com> wrote:
>> >> I would try
>> >> SIGNAL("layersWillBeRemoved(QStringList)")
>> >>
>> >
>> > Oh but its not a string list that the signal is emitting but rather a
>> > QList of pointers to map layers?
>> >
>>
>> Oh sorry I see I was the source of confusion with my python snippet -
>> yes it is the added slot I am interested in.
>>
>
> I noticed that signal is already defined in the API:
>
> void QgsMapLayerRegistry::layersWillBeRemoved (QStringList  theLayerIds)
>
> Are you replacing or overloading it?
>
> If you're overloading it, could PyQt be getting confused by seeing both
> signals as returning a list?
>
>
>
>> >> On 04/19/2012 11:09 AM, Tim Sutton wrote:
>> >>
>> >> Hi All
>> >>
>> >> Does anyone know the appropriate way to connect to the new
>> >> QgsMapLayerRegistry signal I added in python:
>> >>
>> >> void layersAdded( QList<QgsMapLayer *> theMapLayers );
>> >>
>> >> I tried:
>> >>
>> >>             QtCore.QObject.connect(QgsMapLayerRegistry.instance(),
>> >>
>> >> QtCore.SIGNAL('layersWillBeRemoved(QList<QgsMapLayer*>)'),
>> >>                     self.getLayers)
>> >>
>> >> But that doesnt seem to be hitting my slot.
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20120419/53c9b35e/attachment.html


More information about the Qgis-developer mailing list