[QGIS-Developer] Confused by QGIS 3 Labeling

C Hamilton adenaculture at gmail.com
Thu Jul 6 08:06:52 PDT 2017


Formally I was using the following in my code to add a default label to my
points vector layer:

            label = QgsPalLayerSettings()
            label.readFromLayer(ptLayer)
            label.enabled = True
            label.fieldName = 'label'
            label.placement= QgsPalLayerSettings.AroundPoint
            label.writeToLayer(ptLayer)

In looking at the api break documentation readFromLayer and writeToLayer
have been removed and I need to somehow use QgsAbstractVectorLayerLabeling,
but I cannot see what I need to change just to add a label to my point
layer. I am not trying to do anything fancy. All I want is to specify a
field to be used to label the points layer and just use the default
styling. Any help understanding the new API changes would be appreciated.

Thanks,

Calvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170706/c0c26267/attachment-0001.html>


More information about the QGIS-Developer mailing list