[Qgis-developer] QgsFields has not method values()

Gino Pirelli luipir at gmail.com
Sun Jul 28 07:34:58 PDT 2013


well... a better solution:
change: flds = pr.fields() in
 flds = pr.fieldNameMap()
and leave: self.layerAttrsCombo.addItems(
self.getFieldNames4Combo(flds.values()) )

ciao ginetto

On 28 July 2013 13:41, Gino Pirelli <luipir at gmail.com> wrote:
> I know! i was changing to 2.0 api... Natan shown me that
> QgsVectorDataProvider.fields() changed from QMap to QList... QMap has
> values() method, but QList no... but solution is to erase values()
> call beacuse called funcion need a QFields list.
>
> thanks anyway, ginetto
>
> On 28 July 2013 13:34, Alexander Bruy <alexander.bruy at gmail.com> wrote:
>> Hi,
>>
>> plugin you used is not update to QGIS 2 API changes.
>>
>> 2013/7/28 Gino Pirelli <luipir at gmail.com>:
>>> Hi
>>>
>>> what was the result of QgsFields.values()? I've no documentation in
>>> master and in 1.8!
>>>
>>> I've this error in a plugin:
>>>
>>>  File "/home/ginetto/.qgis2/python/plugins/rt_postgres_extractor/WizPage1.py",
>>> line 187, in fillLayerAttrsCombo
>>>     self.layerAttrsCombo.addItems(  self.getFieldNames4Combo(flds.values()) )
>>> AttributeError: 'QgsFields' object has no attribute 'values'
>>>
>>> from this code:
>>>
>>> pr = layer.dataProvider()
>>> flds = pr.fields()
>>> self.layerAttrsCombo.addItems(  self.getFieldNames4Combo(flds.values()) )
>>>
>>> where layer is a QgsVectorLayer => pr is a QgsVectorDataProvider
>>>
>>> ciao ginetto
>>> _______________________________________________
>>> Qgis-developer mailing list
>>> Qgis-developer at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
>>
>> --
>> Alexander Bruy


More information about the Qgis-developer mailing list