I have a QcomboBox that shows attributes from a field, each attribute occurs only one time. I am trying to get the id of the selected attribute\feature so I can then use setSelectedFeatures(), and then zoomToSelected(). I though there are similar examples, I can’t figure out how to get only the id of the selected feature.
Does anybody have a suggestion?
here is my code:
def run(self): """Run method that performs all the real work""" layer = iface.addVectorLayer("C:\Users\carmel.han\Documents\QGIS\qgis_sample_data\shapefiles/regions.shp", "regions", "ogr") if not layer: print "Layer failed to load!" Feature_list =  self.dlg.comboBox.clear() for feature in layer.getFeatures(): name =feature ["name_2"] Feature_list.append(name) self.dlg.comboBox.addItems(Feature_list) id= layer.setSelectedFeatures(id) iface.mapCanvas().zoomToSelected()