在本页

QtTaskTree::Else Class

class QtTaskTree::Else

条件表达式中使用的 "else "元素。更多

头文件: #include <qconditional.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS TaskTree)
target_link_libraries(mytarget PRIVATE Qt6::TaskTree)
qmake: QT += tasktree
Qt 6.11

注意:该类中的所有函数都是可重入的

公共函数

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

详细说明

条件表达式 else 分支的主体。其前面必须始终有Then 元素。

另请参见 If,Then, 和ElseIf

成员函数文档

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

创建条件表达式的 else 分支机构元素,包含children 项。如果前一个条件以错误结束,则跳过前面的Then 主体,选择this 分支。在这种情况下,运行中的QTaskTree 会执行children ,执行结果就是整个条件表达式的最终结果。

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

根据children 给出的std::initializer_list 构造 else 分支机构元素。

这是一个重载函数。

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