[QGIS-Developer] process bar in processing algs

matteo matteo.ghetta at gmail.com
Tue Jul 20 02:52:34 PDT 2021


Hi Pierluigi,


> can you please explain me better?
> I have self plugin that in particular part use this code
> 
> result_grid = processing.run("native:creategrid", params_creategrid)

as explained by Prem, if you want to add the progress when you call a 
"native" algorithm of QGIS within your algorithm, then you can pass to 
the algorithm parameters:

result_grid = processing.run("native:creategrid", params_creategrid, 
context=context, feedback=feedback)

be aware also at the `is_child` parameter. Have a look at the example:

https://docs.qgis.org/3.4/en/docs/user_manual/processing/scripts.html#extending-qgsprocessingalgorithm

if you want to add steps to the progressBar with your logic then you can 
use feedback.setProgress(number) to fill the progress bar. Have a look 
at the template script and you will find a fine usage

Hope this helps

Matteo


More information about the QGIS-Developer mailing list