QtTaskTree::QDefaultTaskAdapter Class
template <typename Task> class QtTaskTree::QDefaultTaskAdapter一个类模板,提供QCustomTask 中使用的默认任务适配器。更多内容...
| 头文件: | #include <qtasktree.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS TaskTree) target_link_libraries(mytarget PRIVATE Qt6::TaskTree) |
| qmake: | QT += tasktree |
| 自: | Qt 6.11 |
| 状态: | 技术预览 |
本类处于技术预览阶段,内容可能会有变动。
注意:该类中的所有函数均为可重入的。
详细说明
QDefaultTaskAdapter<Task> 是一个模板类,其中Task 指定了要适配的任务类型。
当满足以下条件时,可使用适配 Task 的 QDefaultTaskAdapter:
- 该 Task 类继承自QObject 。
- 该 Task 具有用于启动任务的 public start() 方法。
- Task 在完成时会发出 done(QtTaskTree::DoneResult) 或 done(bool) 信号。
如果上述任一条件未满足,则应提供自定义适配器类型,将该 Task 类型适配到QCustomTask<Task, Adapter> 类模板中。
© 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.