[QGIS-Developer] Another QGIS 2 to 3 API Change - How to Adapt
C Hamilton
adenaculture at gmail.com
Fri May 12 12:56:37 PDT 2017
Here is another problem I have encountered converting a plugin from QGIS 2
to 3.
In my plugin I want to automatically create a point layer and have the
point labeled. Here is how I used to do it:
label = QgsPalLayerSettings()
label.readFromLayer(ptLayer)
label.enabled = True
label.fieldName = 'label'
label.placement= QgsPalLayerSettings.AroundPoint
label.setDataDefinedProperty(QgsPalLayerSettings.Size,True,True,'9','')
label.writeToLayer(ptLayer)
In QGIS 3 setDataDefinedProperty() is no longer a method. It looks like it
has been replaced with setDataDefinedProperties()
How do I set the font size in QGIS 3 similar to what I was doing in QGIS 2?
Thanks!!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170512/0f90361c/attachment.html>
More information about the QGIS-Developer
mailing list