I have a dynamic data entry from to which I am adding combo boxes on he fly
using lists
# here I add labels and combo boxes to the form from a list ..
self.dlg.ui.streamEditCustomFormLayout.addWidget(comboBoxNewLabel[dropbox_counter])
self.dlg.ui.streamEditCustomFormLayout.addWidget(comboBoxNew[dropbox_counter])
# and then add a signal to trigger updating of the attribute in a table with
the value selected in the combo box via the changeValue function
QObject.connect(comboBoxNew[dropbox_counter],SIGNAL("currentIndexChanged(QString)"),self.changeValue)
the function I have works but so is set to change always attribute column 2 (in
bold)
def changeValue(self, value):
mc = self.canvas # the map cabavs uin QGIS
layer = mc.currentLayer() # a layer in QGIS
ob = layer.selectedFeaturesIds()
layer.changeAttributeValue(int(ob[0]),2,value) # Change value for
colum 2
How can I add one additional parameter to the function call form the combo box ?
Something like
QObject.connect(comboBoxNew[dropbox_counter],SIGNAL("currentIndexChanged(QString)"),self.changeValue(self,
dropbox_counter))
def changeValue(self, value, colum_id):
mc = self.canvas
layer = mc.currentLayer()
ob = layer.selectedFeaturesIds()
layer.changeAttributeValue(int(ob[0]),colum_id,value)
but with this I am getting
QObject.connect(comboBoxNew[dropbox_counter],SIGNAL("currentIndexChanged(QString)"),self.changeValue(self,
dropbox_counter))
TypeError: arguments did not match any overloaded call:
QObject.connect(QObject, SIGNAL(), QObject, SLOT(),
Qt.ConnectionType=Qt.AutoConnection): argument 3 has unexpected type 'NoneType'
QObject.connect(QObject, SIGNAL(), callable,
Qt.ConnectionType=Qt.AutoConnection): argument 3 has unexpected type 'NoneType'
QObject.connect(QObject, SIGNAL(), SLOT(),
Qt.ConnectionType=Qt.AutoConnection): argument 2 has unexpected type 'str'
How can this be done correctly ?
Karsten
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt