I am developing a plugin which allows the user to edit the features attribute information. I have a combo box from which user can select the layer name for which attributes are to be edited. I need to add field names of layer selected in combo box as labels along with empty line edit boxes. How this can be done?
layers = self.iface.legendInterface().layers()
layer_list = []
for layer in layers:
layer_list.append(layer.name())
self.dlg.comboBox.addItems(layer_list)
selectedLayerIndex = self.dlg.comboBox.currentIndex()
selectedLayer = layers[selectedLayerIndex]
fields = selectedLayer.pendingFields()
fieldnames = [field.name() for field in fields]