- Extending Qt Creator Manual
- TaskTree
- QMappedTaskTreeRunner
- Extending Qt Creator Manual 19.0.0-beta2

# QMappedTaskTreeRunner Class

template <typename Key> class QMappedTaskTreeRunner

A mapped task tree execution controller with a given Key type. More...

Header: | `#include <qtasktreerunner.h>`

- List of all members, including inherited members

## Public Functions

| QMappedTaskTreeRunner(QObject *parent = nullptr)
| ~QMappedTaskTreeRunner()
void | cancel()
void | cancelKey(const Key &key)
bool | isKeyRunning(const Key &key) const
bool | isRunning() const
void | reset()
void | resetKey(const Key &key)
void | start(const Key &key, const QtTaskTree::Group &recipe, SetupHandler &&setupHandler = {}, DoneHandler &&doneHandler = {}, QtTaskTree::CallDoneFlags callDone = QtTaskTree::CallDone::Always)

## Detailed Description

Manages mapped task tree execution using `Key` type. Use the start() method to execute a recipe for a given key unconditionally, resetting a possibly running task tree with the same key, and keeping other possibly running task trees with different keys in parallel.

## Member Function Documentation

### QMappedTaskTreeRunner::QMappedTaskTreeRunner(QObject *parent = nullptr)

Constructs a mapped task tree runner for the given parent. The `Key` type is used for task tree mapping.

### QMappedTaskTreeRunner::~QMappedTaskTreeRunner()

Destroys the mapped task tree runner. All running task trees are deleted. No task trees' done handlers are called nor done() signals are emitted.

See also ~QTaskTree().

### void QMappedTaskTreeRunner::cancel()

Cancels all running task trees. Calls task trees' done handlers and emits done() signals with DoneWith::Cancel. The order of task trees' cancellation is random.

### void QMappedTaskTreeRunner::cancelKey(const Key &key)

Cancels a potentially running task tree that was started with the key. Calls task tree's done handler and emits done() signal with DoneWith::Cancel.

### bool QMappedTaskTreeRunner::isKeyRunning(const Key &key) const

Returns whether the mapped task tree runner is currently executing a task tree that was started with the key.

### bool QMappedTaskTreeRunner::isRunning() const

Returns whether the mapped task tree runner is currently executing at least one task tree.

### void QMappedTaskTreeRunner::reset()

Resets all running task trees. No task trees' done handlers are called nor done() signals are emitted.

### void QMappedTaskTreeRunner::resetKey(const Key &key)

Resets a potentially running task tree that was started with the key. No task tree's done handlers is called nor done() signal is emitted.

### template <typename SetupHandler, typename DoneHandler> void QMappedTaskTreeRunner::start(const Key &key, const QtTaskTree::Group &recipe, SetupHandler &&setupHandler = {}, DoneHandler &&doneHandler = {}, QtTaskTree::CallDoneFlags callDone = QtTaskTree::CallDone::Always)

Starts the recipe for a given key unconditionally, resetting any possibly running task tree with the same key, and keeping other possibly running task trees with different keys in parallel. Calls setupHandler when new task tree is about to be started. Calls doneHandler when the task tree is finished. The doneHandler is called according to the passed callDone.