[Qgis-developer] Re: fields = provider.fields() how can i iterate to get field name ?

marco bra marcobra.ubuntu at gmail.com
Thu May 19 11:51:20 EDT 2011


Solved...

		layer = self.iface.activeLayer() # layer attivo
		if (layer):
			layer.startEditing()
	                provider = layer.dataProvider()
			#provider.rewind()
			#feat = QgsFeature()
        	        nameLayer = layer.name()
        	        # print nameLayer
			fields = provider.fields()
			if layer.type() == QgsMapLayer.VectorLayer:
				self.QLEvalore.setText("set value here")
				self.CBfields.clear()
				for name in fields:
					self.CBfields.addItem(fields[name].name())


More information about the Qgis-developer mailing list