[QGIS-Developer] Load layer with style in Processing plugin

matteo matteo.ghetta at gmail.com
Wed May 30 23:58:13 PDT 2018

Hi Nyall,

thanks for the answer.

> In 3.2 it should be possible, using a subclass of
> QgsProcessingLayerPostProcessorInterface and
>     context.layerToLoadOnCompletionDetails( output_dest_id
> ).setPostProcessor( my_layer_post_processor() )
> Your QgsProcessingLayerPostProcessorInterface subclass would set the
> style for the layer in its postProcessLayer implementation.
> This is the canonical, thread safe way to do this in processing... any
> other approach (and there's other hacky ways to do this) will not be
> thread safe and may crash! We probably should make this a bit easier
> and have a direct `context.layerToLoadOnCompletionDetails(
> output_dest_id ).setLayerStyle(..... )` call, but it's too late for
> 3.2....

eheh, sorry too late to test all Processing options (too many of them ;) ).

what you suggested to implement in the future sounds as the smoothest idea.

Thanks again for the hints!


More information about the QGIS-Developer mailing list