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: 6.11

Public Functions

~QSequentialTaskTreeRunner()
QtTaskTree::Q_TASKTREE_EXPORT cancel()
QtTaskTree::Q_TASKTREE_EXPORT cancelCurrent()
void enqueue(const QtTaskTree::Group &recipe, SetupHandler &&setupHandler = {}, DoneHandler &&doneHandler = {}, QtTaskTree::CallDone callDone = QtTaskTree::CallDoneFlag::Always)
QtTaskTree::Q_TASKTREE_EXPORT isRunning() const
QtTaskTree::Q_TASKTREE_EXPORT reset()
QtTaskTree::Q_TASKTREE_EXPORT 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

[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().

QtTaskTree::Q_TASKTREE_EXPORT QSequentialTaskTreeRunner::cancel()

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

QtTaskTree::Q_TASKTREE_EXPORT 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.

QtTaskTree::Q_TASKTREE_EXPORT QSequentialTaskTreeRunner::isRunning() const

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

QtTaskTree::Q_TASKTREE_EXPORT QSequentialTaskTreeRunner::reset()

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

QtTaskTree::Q_TASKTREE_EXPORT 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.