Task manager for managing a set of long-running QgsTask tasks.
More...
#include <qgstaskmanager.h>
Task manager for managing a set of long-running QgsTask tasks.
This class can be created directly, or accessed via QgsApplication::taskManager().
- Since
- QGIS 3.0
Definition at line 392 of file qgstaskmanager.h.
◆ QgsTaskManager()
QgsTaskManager::QgsTaskManager |
( |
QObject * |
parent = nullptr | ) |
|
◆ ~QgsTaskManager()
QgsTaskManager::~QgsTaskManager |
( |
| ) |
|
|
override |
◆ activeTasks()
QList< QgsTask * > QgsTaskManager::activeTasks |
( |
| ) |
const |
◆ addTask() [1/2]
long QgsTaskManager::addTask |
( |
const TaskDefinition & |
task, |
|
|
int |
priority = 0 |
|
) |
| |
Adds a task to the manager, using a full task definition (including dependency handling).
Ownership of the task is transferred to the manager, and the task manager will be responsible for starting the task. The priority argument can be used to control the run queue's order of execution, with larger numbers taking precedence over lower priority numbers.
- Returns
- unique task ID, or 0 if task could not be added
Definition at line 421 of file qgstaskmanager.cpp.
◆ addTask() [2/2]
long QgsTaskManager::addTask |
( |
QgsTask * |
task, |
|
|
int |
priority = 0 |
|
) |
| |
Adds a task to the manager.
Ownership of the task is transferred to the manager, and the task manager will be responsible for starting the task. The priority argument can be used to control the run queue's order of execution, with larger numbers taking precedence over lower priority numbers.
- Returns
- unique task ID, or 0 if task could not be added
Definition at line 416 of file qgstaskmanager.cpp.
◆ allTasksFinished
void QgsTaskManager::allTasksFinished |
( |
| ) |
|
|
signal |
◆ cancelAll()
void QgsTaskManager::cancelAll |
( |
| ) |
|
Instructs all tasks tracked by the manager to terminate.
Individual tasks may take some time to cancel, or may totally ignore this instruction. Calling this does not block but will instead signal the tasks to cancel and then return immediately.
Definition at line 542 of file qgstaskmanager.cpp.
◆ count()
int QgsTaskManager::count |
( |
| ) |
const |
◆ countActiveTasks()
int QgsTaskManager::countActiveTasks |
( |
bool |
includeHidden = true | ) |
const |
◆ countActiveTasksChanged
void QgsTaskManager::countActiveTasksChanged |
( |
int |
count | ) |
|
|
signal |
◆ dependencies()
QSet< long > QgsTaskManager::dependencies |
( |
long |
taskId | ) |
const |
Returns the set of task IDs on which a task is dependent.
- Note
- not available in Python bindings
Definition at line 576 of file qgstaskmanager.cpp.
◆ dependenciesSatisfied()
bool QgsTaskManager::dependenciesSatisfied |
( |
long |
taskId | ) |
const |
Returns true
if all dependencies for the specified task are satisfied.
Definition at line 556 of file qgstaskmanager.cpp.
◆ dependentLayers()
QList< QgsMapLayer * > QgsTaskManager::dependentLayers |
( |
long |
taskId | ) |
const |
Returns a list of layers on which as task is dependent.
The task will automatically be canceled if any of these layers are about to be removed.
- Parameters
-
- Returns
- list of layers
- See also
- tasksDependentOnLayer()
Definition at line 631 of file qgstaskmanager.cpp.
◆ finalTaskProgressChanged
void QgsTaskManager::finalTaskProgressChanged |
( |
double |
progress | ) |
|
|
signal |
Will be emitted when only a single task remains to complete and that task has reported a progress change.
- Parameters
-
progress | percent of progress, from 0.0 - 100.0 |
◆ progressChanged
void QgsTaskManager::progressChanged |
( |
long |
taskId, |
|
|
double |
progress |
|
) |
| |
|
signal |
Will be emitted when a task reports a progress change.
- Parameters
-
taskId | ID of task |
progress | percent of progress, from 0.0 - 100.0 |
◆ statusChanged
void QgsTaskManager::statusChanged |
( |
long |
taskId, |
|
|
int |
status |
|
) |
| |
|
signal |
Will be emitted when a task reports a status change.
- Parameters
-
taskId | ID of task |
status | new task status |
◆ task()
QgsTask * QgsTaskManager::task |
( |
long |
id | ) |
const |
Returns the task with matching ID.
- Parameters
-
- Returns
- task if found, or
nullptr
Definition at line 504 of file qgstaskmanager.cpp.
◆ taskAboutToBeDeleted
void QgsTaskManager::taskAboutToBeDeleted |
( |
long |
taskId | ) |
|
|
signal |
Emitted when a task is about to be deleted.
- Parameters
-
◆ taskAdded
void QgsTaskManager::taskAdded |
( |
long |
taskId | ) |
|
|
signal |
Emitted when a new task has been added to the manager.
- Parameters
-
◆ taskId()
long QgsTaskManager::taskId |
( |
QgsTask * |
task | ) |
const |
Returns the unique task ID corresponding to a task managed by the class.
- Parameters
-
- Returns
- task ID, or -1 if task not found
Definition at line 525 of file qgstaskmanager.cpp.
◆ tasks()
QList< QgsTask * > QgsTaskManager::tasks |
( |
| ) |
const |
◆ tasksDependentOnLayer()
◆ taskTriggered
void QgsTaskManager::taskTriggered |
( |
QgsTask * |
task | ) |
|
|
signal |
Emitted when a task is triggered.
This occurs when a user clicks on the task from the QGIS GUI, and can be used to show detailed progress reports or re-open a related dialog.
- See also
- triggerTask()
◆ triggerTask
void QgsTaskManager::triggerTask |
( |
QgsTask * |
task | ) |
|
|
slot |
◆ TestQgsTaskManager
friend class TestQgsTaskManager |
|
friend |
The documentation for this class was generated from the following files: