QgsProxyProgressTask class

A QgsTask shell which proxies progress reports.

Simple task shell which runs until finalized and reports progress only. This is usually used to expose a blocking operation's progress via task manager.

Base classes

class QgsTask
Abstract base class for long running background tasks.

Constructors, destructors, conversion operators

QgsProxyProgressTask(const QString& description)
Constructor for QgsProxyProgressTask, with the specified description.

Public functions

void finalize(bool result)
Finalizes the task, with the specified result.
auto run() -> bool override
Performs the task's operation.
void setProxyProgress(double progress)
Sets the progress (from 0 to 100) for the proxied operation.

Function documentation

void QgsProxyProgressTask::finalize(bool result)

Finalizes the task, with the specified result.

This should be called when the operation being proxied has completed, to remove this proxy task from the task manager.

bool QgsProxyProgressTask::run() override

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.

void QgsProxyProgressTask::setProxyProgress(double progress)

Sets the progress (from 0 to 100) for the proxied operation.

This method is safe to call from the main thread.