本页内容

QtTaskTree::QMappedTaskTreeRunner Class

template <typename Key> class QtTaskTree::QMappedTaskTreeRunner

一个具有给定 Key 类型的映射任务树执行控制器。更多...

头文件: #include <qtasktreerunner.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS TaskTree)
target_link_libraries(mytarget PRIVATE Qt6::TaskTree)
qmake: QT += tasktree
自: Qt 6.11
状态: 技术预览

该类处于技术预览阶段,内容可能会有变动。

公共函数

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)

详细说明

使用Key 类型管理映射任务树的执行。使用start()方法无条件地执行给定键的配方,重置可能正在运行的具有相同键的任务树,并保持其他可能正在运行的具有不同键的任务树并行执行。

另请参阅 Task Tree Runners 。

成员函数文档

[default] QMappedTaskTreeRunner::QMappedTaskTreeRunner()

构建一个映射的任务树运行器。Key 类型用于任务树映射。

[default] QMappedTaskTreeRunner::~QMappedTaskTreeRunner()

销毁已映射的任务树运行器。所有正在运行的任务树均被删除。不会调用任何任务树的完成处理程序。

另请参阅 ~QTaskTree()。

void QMappedTaskTreeRunner::cancel()

取消所有正在运行的任务树。使用DoneWith::Cancel 调用任务树的完成处理程序。任务树的取消顺序是随机的。

void QMappedTaskTreeRunner::cancelKey(const Key &key)

取消一个可能正在运行的、通过key 启动的任务树。使用DoneWith::Cancel 调用任务树的完成处理程序。

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

返回映射的任务树运行器当前是否正在执行一个由key 启动的任务树。

bool QMappedTaskTreeRunner::isRunning() const

返回映射的任务树运行器当前是否正在执行至少一个任务树。

void QMappedTaskTreeRunner::reset()

重置所有正在运行的任务树。不会调用任何任务树的完成处理程序。

void QMappedTaskTreeRunner::resetKey(const Key &key)

重置一个可能正在运行的、通过key 启动的任务树。不会调用该任务树的任何完成处理程序。

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)

无条件地为给定的key 启动recipe ,重置任何可能正在运行且具有相同键的任务树,并并行保留其他可能正在运行且具有不同键的任务树。当新任务树即将启动时,调用setupHandler 。当任务树完成时,调用doneHandler 。根据传入的callDone 调用doneHandler 。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.