[Qgis-developer] PyQT - How to get layer sending attributeValueChanged signal?
Marco Bernasocchi
marco at bernawebdesign.ch
Tue Feb 25 01:29:42 PST 2014
Regis, did you try use the @pyqtSlot(your types) decorator for your slot?
Often a slot getting called twice is because the signal is emitted twic
with different signatures.
ciao
Marco
On 24.02.2014 17:30, HAUBOURG wrote:
>
>
> A followup:
> I had my class inherit from QObject (first time doing that for me) and I catch the sender correctly.
> Strangely, I catch the signal twice, so maybe inherinting from QObject triggers another signalk somewhere..
> Cheers
>
>
>> -----Message d'origine-----
>> De : Matthias Kuhn [mailto:matthias.kuhn at gmx.ch]
>> Envoyé : lundi 24 février 2014 15:21
>> À : HAUBOURG
>> Cc : qgis-developer at lists.osgeo.org
>> Objet : Re: [Qgis-developer] PyQT - How to get layer sending
>> attributeValueChanged signal?
>>
>> Hi Régis
>>
>> Calling sender() in your SLOT should return the QgsVectorLayer object There
>> is also QSignalMapper [1] which has a cleaner concept, but it looks as if this
>> will on the one hand help you to identify the source layer, but you will loose
>> any other parameters, what's probably not your intent.
>>
>> Best
>> Matthias
>>
>> [1] http://qt-project.org/doc/qt-4.8/qsignalmapper.html
>>
>> On Mon 24 Feb 2014 02:57:37 PM CET, Régis Haubourg wrote:
>>> Hi,
>>> I would like to catch the layer or layer id that is sending
>>> attributeValueChanged signal.
>>> This signal carries only QgsFeatureId fid, int idx, const QVariant & )
>>
>>>
>>> Any idea how to do this in a clean way?
>>>
>>> Cheers,
>>> Régis
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://osgeo-org.1560.x6.nabble.com/PyQT-How-to-get-layer-sending-
>> attr
>>> ibuteValueChanged-signal-tp5105532.html
>>> Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
>>> _______________________________________________
>>> Qgis-developer mailing list
>>> Qgis-developer at lists.osgeo.org
>>> 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
>
--
Marco Bernasocchi
http://opengis.ch
More information about the Qgis-developer
mailing list