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:
    selectedLayerIndex = self.dlg.comboBox.currentIndex()
    selectedLayer = layers[selectedLayerIndex]
    fields = selectedLayer.pendingFields()
    fieldnames = [field.name() for field in fields]

Something like this enter image description here

1 Answer 1


I don't know there is need to create such thing, cuz it already exists.

As far as I understand you want this:

iface.getFeatureForm(layer, feature)

Here you have more info about it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.