[QGIS-Developer] Another QGIS 2 to 3 API Change - How to Adapt

Luigi Pirelli luipir at gmail.com
Fri May 12 14:07:25 PDT 2017


Some example directly from the qgis source code,

https://qgis.org/api/qgssymbol_8cpp_source.html#l01304

generally speaking, in this transitional phase, the source code is the
preferred documentation.

regards


Luigi Pirelli

**************************************************************************************************
* Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com
* LinkedIn: https://www.linkedin.com/in/luigipirelli
* Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
* GitHub: https://github.com/luipir
* Mastering QGIS 2nd Edition:
* https://www.packtpub.com/big-data-and-business-intelligence/mastering-qgis-second-edition
**************************************************************************************************


On 12 May 2017 at 21:56, C Hamilton <adenaculture at gmail.com> wrote:
> 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!!!
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list