本页内容

QtTaskTree::Forever Class

class QtTaskTree::Forever

子任务的无限循环。更多...

标题: #include <qtasktree.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS TaskTree)
target_link_libraries(mytarget PRIVATE Qt6::TaskTree)
qmake: QT += tasktree
自: Qt 6.11
继承自: QtTaskTree::ExecutableItem
状态: 技术预览

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

注意:该类中的所有函数均为可重入函数。

公共函数

Forever(const QtTaskTree::GroupItems &children)
Forever(std::initializer_list<QtTaskTree::GroupItem> children)

详细说明

传递给构造函数的任务将不断重复,直到其中某项任务导致主体的工作流策略停止执行为止。默认情况下,主体将不断重复,直到某项任务以错误结束为止。

有关将组处理程序和Storage 作为 Forever 主体的直接子元素放置的更多信息,请参阅Do 文档。

另请参阅 For 和ForeverIterator 。

成员函数文档

[explicit] Forever::Forever(const QtTaskTree::GroupItems &children)

构建一个无限循环,该循环执行children 。

以下代码片段:

const Group recipe = Forever {
    task1,
    task2
};

等同于:

const Group recipe = For (ForeverIterator()) >> Do {
    task1,
    task2
};

[explicit] Forever::Forever(std::initializer_list<QtTaskTree::GroupItem> children)

构建一个无限循环,该循环执行作为初始化列表传递的children 。

这是一个重载函数。

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