Perhaps use the currentIndex() method on the combobox inside your changeValue function ...<div class="im"><br><br>def changeValue(self, value):<br> mc = self.canvas<br></div> layer = mc.currentLayer()<br>
obj= layer.selectedFeatureIds()<br> layer.changeAttributeValue(<div id=":j">int(obj[0], <b>yourComboBox.currentIndex()</b>, value)<br><br><br>You
can also use a not very highly recommend way, with lambda, however it
sucks for garbage cleanup, it's sloppy python,and you will no longer get
your QString passed.... off the top of my head it would be something
like ....<br>
<br><span><span><font color="#000080" size="2" face="Arial">QObject.connect(comboBoxNew[dropbox_counter],SIGNAL("currentIndexChanged(QString)"), lambda: self.changeValue(self,
dropbox_counter))</font></span></span></div><br><br><div class="gmail_quote">On Fri, Apr 22, 2011 at 8:07 PM, karsten vennemann <span dir="ltr"><<a href="mailto:karsten@terragis.net">karsten@terragis.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>
<div><font face="Arial"><font color="#000080"><font size="2"><span>I have a dynamic data entry from to which I am adding
combo boxes on he fly using lists</span></font></font></font></div>
<div><font face="Arial"><font color="#000080"><font size="2"><span></span></font></font></font> </div>
<div><font face="Arial"><font color="#000080"><font size="2"><span> </span> # here I add labels and combo boxes
to the form from a list
..<br>self.dlg.ui.streamEditCustomFormLayout.addWidget(comboBoxNewLabel[dropbox_counter])<br>self.dlg.ui.streamEditCustomFormLayout.addWidget(comboBoxNew[dropbox_counter])<br><br>#
and <span>then </span>add a signal to trigger
updating <span>of </span>the attribute <span>in a </span>table<span>
</span>with the value selected in the combo box via the changeValue
function<br>QObject.connect(comboBoxNew[dropbox_counter],SIGNAL("currentIndexChanged(QString)"),self.changeValue)<br><br>the
function I have works but so is set to change always attribute column 2 (in
<b>bold</b>)<br><br> def changeValue(self,
value):<br> mc =
self.canvas <span>
# the map cabavs uin QGIS</span><br>
layer = mc.currentLayer()<span> # a layer in
QGIS</span><br> ob =
layer.selectedFeaturesIds()<span> </span></font></font></font></div>
<div><font face="Arial"><font color="#000080"><font size="2"><span></span>
layer.changeAttributeValue(int(ob[0]),<b>2</b>,value)<span> # Change value for colum 2
</span></font></font></font></div>
<div><font face="Arial"><font color="#000080"><font size="2"><span></span></font></font></font> </div>
<div><span><font color="#000080" size="2" face="Arial">How
can I add one additional parameter to the function call form the combo box
?</font></span></div>
<div><span><font color="#000080" size="2" face="Arial"></font></span> </div>
<div><span><font color="#000080" size="2" face="Arial"></font></span> </div>
<div><span><font color="#000080" size="2" face="Arial">Something like</font></span></div>
<div><span><font color="#000080" size="2" face="Arial"></font></span> </div>
<div><span>
<div dir="ltr" align="left"><span><font color="#000080" size="2" face="Arial">QObject.connect(comboBoxNew[dropbox_counter],SIGNAL("currentIndexChanged(QString)"),self.changeValue(self,
dropbox_counter))</font></span></div>
<div dir="ltr" align="left"><span><font color="#000080" size="2" face="Arial"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#000080" size="2" face="Arial"> def changeValue(self, value,
colum_id):<br> mc =
self.canvas
<br> layer =
mc.currentLayer()<br> ob =
layer.selectedFeaturesIds()<br>
layer.changeAttributeValue(int(ob[0]),colum_id,value)</font></span></div>
<div dir="ltr" align="left"><span><font color="#000080" size="2" face="Arial"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#000080" size="2" face="Arial"></font></span> </div>
<div dir="ltr" align="left"><span><font face="Arial"><font color="#000080"><font size="2"><span>but </span><span>with this I</span> am
getting</font></font></font></span></div>
<div dir="ltr" align="left"><span>QObject.connect(comboBoxNew[dropbox_counter],SIGNAL("currentIndexChanged(QString)"),self.changeValue(self,
dropbox_counter))<br>TypeError: arguments did not match any overloaded
call:<br> QObject.connect(QObject, SIGNAL(), QObject, SLOT(),
Qt.ConnectionType=Qt.AutoConnection): argument 3 has unexpected type
'NoneType'<br> QObject.connect(QObject, SIGNAL(), callable,
Qt.ConnectionType=Qt.AutoConnection): argument 3 has unexpected type
'NoneType'<br> QObject.connect(QObject, SIGNAL(), SLOT(),
Qt.ConnectionType=Qt.AutoConnection): argument 2 has unexpected type
'str'</span></div></span></div>
<div><span><font color="#000080" size="2" face="Arial"></font></span> </div>
<div><span><font color="#000080" size="2" face="Arial">How
can this be done correctly ?</font></span></div>
<div><font size="2"><span style="font-family:Verdana;font-size:11pt">Karsten</span></font></div></div>
<br>_______________________________________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br></blockquote></div><br>