I am new to python and pyqqis.
I do not have the methods defined in initGUI
how do I do?
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]
self.dlg.comboBox_2.addItems(fieldnames)
The problem is, that in second combobox there are fields from first on layerlist layer, not the selected one.