I'm new to PyQGIS and I'm stuck here.
So I've created a ComboBox so the user could select which layer he wants to work with. Everything's fine so far. I've also added all layers but now I'm having issues to filter the output in the 2nd ComboBox.
for layer in QgsProject.instance().mapLayers().values():
self.dlg.ComboAll.addItem(layer.name())
self.dlg.ComboAll.currentIndexChanged.connect(IndexChange)
So this is how I prompt all layers in my ComboBox and get the information that the user has choosen another option.
def IndexChange():
selectedLayer = self.dlg.ComboAll.currentIndex()
#Prompt every fields of selectedLayer in ComboLayer
And this is how I get the number of the selected layer. But I don't know what to do after that. For example, if the user choose the layer number 3 I only want fields from this layer appearing in my second ComboBox.