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
Inherits: QtTaskTree::QAbstractTaskTreeRunner
Status: Technical Preview

Public Functions

QSequentialTaskTreeRunner(QObject *parent)
virtual ~QSequentialTaskTreeRunner()
void cancelCurrent()
void enqueue(const QtTaskTree::Group &recipe, SetupHandler &&setupHandler = {}, DoneHandler &&doneHandler = {}, QtTaskTree::CallDone callDone = QtTaskTree::CallDoneFlag::Always)
void resetCurrent()

Reimplemented Public Functions

virtual void cancel() override
virtual bool isRunning() const override
virtual void reset() override

Reimplemented Protected Functions

virtual bool event(QEvent *event) override

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.

Member Function Documentation

[explicit] QSequentialTaskTreeRunner::QSequentialTaskTreeRunner(QObject *parent)

Constructs a sequential task tree runner for the given parent.

[virtual 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 nor done() signal is emitted.

See also ~QTaskTree().

[override virtual] void QSequentialTaskTreeRunner::cancel()

Reimplements: QAbstractTaskTreeRunner::cancel().

Cancels the running task tree. Calls task tree' done handler and emits done() signal with DoneWith::Cancel. All queued tasks are removed.

void QSequentialTaskTreeRunner::cancelCurrent()

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

template <typename SetupHandler = QtTaskTree::QAbstractTaskTreeRunner::TreeSetupHandler, typename DoneHandler = QtTaskTree::QAbstractTaskTreeRunner::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.

[override virtual protected] bool QSequentialTaskTreeRunner::event(QEvent *event)

Reimplements: QAbstractTaskTreeRunner::event(QEvent *event).

[override virtual] bool QSequentialTaskTreeRunner::isRunning() const

Reimplements: QAbstractTaskTreeRunner::isRunning() const.

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

[override virtual] void QSequentialTaskTreeRunner::reset()

Reimplements: QAbstractTaskTreeRunner::reset().

Resets the running task tree. No task tree's done handler is called nor done() signal is emitted. All queued tasks are removed.

void QSequentialTaskTreeRunner::resetCurrent()

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