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

marco bra marcobra.ubuntu at gmail.com
Thu May 19 11:46:56 EDT 2011


Hi all

I try to write my first python plugin and i need to iterate a field
list got from the active layer

layer = self.iface.activeLayer() # active layer
		if (layer):
	                provider = layer.dataProvider()
			fields = provider.fields()
			if layer.type() == QgsMapLayer.VectorLayer:
				self.QLEvalore.setText("set value here")
				self.CBfields.clear()
				for field in fields:
					self.CBfields.addItem(field.name())


to get single field name to add to a dialog combobox

How can i get the field name...?

Thank
Marco

-- 
Linux Infinite Freedom


More information about the Qgis-developer mailing list