- Qt 6.12
- Qt TaskTree
- C++ Classes
- QSequentialTaskTreeRunner
- Qt 6.12.0 Reference Documentation

# QtTaskTree::QSequentialTaskTreeRunner Class

class QtTaskTree::QSequentialTaskTreeRunner

A sequential task tree execution controller. 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
Status: | Technology preview

This class is in technology preview and is subject to change.

- List of all members, including inherited members

## Public Functions

| QSequentialTaskTreeRunner()
| ~QSequentialTaskTreeRunner()
void | cancel()
void | cancelCurrent()
void | enqueue(const QtTaskTree::Group &recipe, SetupHandler &&setupHandler = {}, DoneHandler &&doneHandler = {}, QtTaskTree::CallDone callDone = QtTaskTree::CallDoneFlag::Always)
bool | isRunning() const
void | reset()
void | resetCurrent()

## Detailed Description

Manages sequential task tree execution. Use the enqueue() method to schedule the execution of a given recipe. It's guaranteed that at most one task tree is executing at any given time.

See also Task Tree Runners.

## Member Function Documentation

### QSequentialTaskTreeRunner::QSequentialTaskTreeRunner()

Constructs a sequential task tree runner.

### `[noexcept]` QSequentialTaskTreeRunner::~QSequentialTaskTreeRunner()

Destroys the sequential task tree runner. A possibly running task tree is deleted and enqueued tasks are removed. No task tree's done handler is called.

See also ~QTaskTree().

### void QSequentialTaskTreeRunner::cancel()

Cancels the running task tree. Calls task tree' done handler with DoneWith::Cancel. All queued tasks are removed.

### void QSequentialTaskTreeRunner::cancelCurrent()

Cancels the running task tree. Calls task tree' done handler with DoneWith::Cancel. If there are any enqueued recipes, the dequeued recipe is started.

### template <typename SetupHandler = QtTaskTree::TreeSetupHandler, typename DoneHandler = QtTaskTree::TreeDoneHandler> void QSequentialTaskTreeRunner::enqueue(const QtTaskTree::Group &recipe, SetupHandler &&setupHandler = {}, DoneHandler &&doneHandler = {}, QtTaskTree::CallDone callDone = QtTaskTree::CallDoneFlag::Always)

Schedules the recipe execution. If no task tree is executing, the runner starts a new task tree synchronously, otherwise the recipe is enqueued. When the currently executing task tree finished, the runner starts a new task tree with a dequeued recipe. 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.

### bool QSequentialTaskTreeRunner::isRunning() const

Returns whether the sequential task tree runner is currently executing a task tree.

### void QSequentialTaskTreeRunner::reset()

Resets the running task tree. No task tree's done handler is called. All queued tasks are removed.

### void QSequentialTaskTreeRunner::resetCurrent()

Resets the running task tree. No task tree's done handler is called. If there are any enqueued recipes, the dequeued recipe is started.