Class: QgsTaskWrapper

class qgis.core.QgsTaskWrapper(description, flags, function, on_finished, *args, **kwargs)

Bases: qgis._core.QgsTask

Methods

finished If the task is managed by a QgsTaskManager, this will be called after the task has finished (whether through successful completion or via early termination).
run Performs the task’s operation.

Signals

Attributes

finished(self, result: bool)

If the task is managed by a QgsTaskManager, this will be called after the task has finished (whether through successful completion or via early termination). The result argument reflects whether the task was successfully completed or not. This method is always called from the main thread, so it is safe to create widgets and perform other operations which require the main thread. However, the GUI will be blocked for the duration of this method so tasks should avoid performing any lengthy operations here.

run(self) → bool

Performs the task’s operation. This method will be called when the task commences (ie via calling start() ), and subclasses should implement the operation they wish to perform in the background within this method.

A task must return a boolean value to indicate whether the task was completed successfully or terminated before completion.