[QGIS-Developer] Update layer styling panel using Python

Anita Graser anitagraser at gmx.at
Mon Mar 9 12:04:20 PDT 2020


The open doc issue ticket also relates to the layer styling panel
https://github.com/qgis/QGIS-Documentation/issues/2071

It references an old blog post by Nathan which has meanwhile moved to
https://woostuff.wordpress.com/2016/06/29/qgis-style-dock-part-2-plugin-panels/.
This post illustrates how to add a panel but I couldn't find pointers on
how to update an existing one.

Regards,
Anita



On Sun, Mar 8, 2020 at 9:10 PM Anita Graser <anitagraser at gmx.at> wrote:

> Hi,
>
> After changing a layer's symbology using Python, how can I update the
> layer styling panel to reflect the changes? I'm specifically asking because
> data-defined overrides are not displayed after
>
> exp = 'coalesce(scale_exp("pop_max", 0, 10000000, 0, 7, 0.57), 0)'
> vlayer.renderer().symbol().symbolLayer(0).setDataDefinedProperty(
>     QgsSymbolLayer.PropertySize, QgsProperty.fromExpression(exp) )
> vlayer.triggerRepaint()
>
> Regards,
> Anita
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200309/e171b2e5/attachment.html>


More information about the QGIS-Developer mailing list