QtTaskTree::QMappedTaskTreeRunner Class | Qt TaskTree | Qt 6.11.1
Description: A mapped task tree execution controller with a given Key type.

- Qt 6.11
- Qt TaskTree
- C++ Classes
- QMappedTaskTreeRunner
- Qt 6.11.1 Reference Documentation

# QtTaskTree::QMappedTaskTreeRunner Class

template <typename Key> class QtTaskTree::QMappedTaskTreeRunner

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

Header: | `#include <qtasktreerunner.h>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS TaskTree)` `target_link_libraries(mytarget PRIVATE Qt6::TaskTree)`
qmake: | `QT += tasktree`
Since: | Qt 6.11

- List of all members, including inherited members

## Public Functions

| QMappedTaskTreeRunner()
| ~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::CallDone callDone = QtTaskTree::CallDoneFlag::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.

See also Task Tree Runners.

## Member Function Documentation

### QMappedTaskTreeRunner::QMappedTaskTreeRunner()

Constructs a mapped task tree runner. 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.

See also ~QTaskTree().

### void QMappedTaskTreeRunner::cancel()

Cancels all running task trees. Calls task trees' done handlers 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 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.

### 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.

### template <typename SetupHandler = QtTaskTree::TreeSetupHandler, typename DoneHandler = QtTaskTree::TreeDoneHandler> void QMappedTaskTreeRunner::start(const Key &key, const QtTaskTree::Group &recipe, SetupHandler &&setupHandler = {}, DoneHandler &&doneHandler = {}, QtTaskTree::CallDone callDone = QtTaskTree::CallDoneFlag::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.