[Qgis-developer] pyQT combo box & QGIS plug-in signal
argumentquestion
karsten vennemann
karsten at terragis.net
Fri Apr 22 22:17:38 EDT 2011
Thanks for all the input I received
I found one seemingly good solution (via internet search) that works using
functools.partial that is available since python 2.5
http://docs.python.org/library/functools.html#functools.partial
My code is then
...
from functools import partial
...
QObject.connect(comboBoxNew[dropbox_counter],SIGNAL("currentIndexChanged(QSt
ring)"),partial(self.changeValue, x = dropbox_counter))
def changeValue(self, value, x):
mc = self.canvas
layer = mc.currentLayer()
ob = layer.selectedFeaturesIds()
layer.changeAttributeValue(int(ob[0]),x,value)
Hopefully that helps someone else too when trying to easily pass an
additional parameter from an QT signal slot ...
Karsten
> -----Original Message-----
> From: Camilo Polymeris [mailto:cpolymeris at gmail.com]
> Sent: Friday, April 22, 2011 16:55
> To: karsten vennemann
> Cc: qgis-developer at lists.osgeo.org
> Subject: Re: [Qgis-developer] pyQT combo box & QGIS plug-in
> signal argumentquestion
>
> It's not very elegant, but you could use QObject.sender(),
> see http://doc.qt.nokia.com/4.7/qobject.html#sender
>
> Regards,
> Camilo
More information about the Qgis-developer
mailing list