Hi,

I am trying to add labels to the plugin  layer. What I use in draw()
is:

 fields = QgsFields()
 fields.append(QgsField('0', QtCore.QVariant.String, 'string', 32))
 fields.append(QgsField('8', QtCore.QVariant.Double, 'double', 8))
 fields.append(QgsField('9', QtCore.QVariant.Double, 'double', 8))

 feat =  QgsFeature(fields)
 label = QgsLabel(fields)
 feat.setAttribute('0','Test Text')
 feat.setAttribute('8', -8.66774)
 feat.setAttribute('9', 37.08391)

 label.renderLabel(renderContext, feat, False)

- QGIS crashes (2.0.1, stock version, Linux)

There is almost no doc on how to add labels to the layer
I am trying to mimic field 'Text' 'XCoordinate' and 'YCoordinate'
with '0', '8' and '9' based on enum LabelField

Apparently also some change in the Api since 1.8, I was
using GridPlugin from 1.8 as example, but something is different now.

Could anyone shed some light on it?

I am actually developing Lat/Lon grid plugin for QGIS, which I think
very much needed.

Thank you
Mikhail
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to