[Qgis-developer] pyQT combo box & QGIS plug-in signal argumentquestion

karsten vennemann karsten at terragis.net
Fri Apr 22 17:45:13 EDT 2011


Maybe I shoud clarify this more
Right now this works:  I can send the signal and have the value of the combox be used to update a field in the attribute table , 
however in addition I would like to add the id of the combobox that I can determine which column should be updated in the changeValue function
How can this be done ?

Karsten

> -----Original Message-----
> From: qgis-developer-bounces at lists.osgeo.org 
> [mailto:qgis-developer-bounces at lists.osgeo.org] On Behalf Of 
> karsten vennemann
> Sent: Friday, April 22, 2011 14:32
> To: qgis-developer at lists.osgeo.org
> Subject: [Qgis-developer] pyQT combo box & QGIS plug-in 
> signal argumentquestion 
> 
> Hi all,
>  
> in a python QGIS plug-in I have a form with a dynamically 
> generated pyQT combo box. 
> Now I am trying to have a change in the combo box send a 
> signal with one argument (which is the id of combo box) to 
> the called function changeValue. Note this changes the 
> attribute of one field in a shape file attribute table and I 
> need the combo box id to know which field will be changed by 
> the changeValue function). How can I do this ?
> So far I have.
>  
>  
> QObject.connect(comboBoxNew[dropbox_counter],SIGNAL("currentIn
> dexChanged(QString)"),self.changeValue)
> 
>     def changeValue(self, value):
>         mc = self.canvas         
>         layer = mc.currentLayer()
>         ob = layer.selectedFeaturesIds()
>         layer.changeAttributeValue(int(ob[0]),self.id(),value)
> 
> Thanks for any hints as I have been  stuck with this for days ;)
> 
> Cheers
> Karsten Vennemann



More information about the Qgis-developer mailing list