QtConcurrent::QTaskBuilder Class
template <typename Task, typename... Args> class QtConcurrent::QTaskBuilderQTaskBuilder 类用于调整任务参数。更多内容...
| 标题: | #include <qtaskbuilder.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Concurrent) target_link_libraries(mytarget PRIVATE Qt6::Concurrent) |
| qmake: | QT += concurrent |
| 自: | Qt 6.0 |
- 所有成员列表(包括继承的成员)
- QTaskBuilder 属于线程类。
公共函数
| QtConcurrent::QTaskBuilder<Task, Args...> & | onThreadPool(QThreadPool &newThreadPool) |
| QFuture<QtConcurrent::InvokeResultType> | spawn() |
| void | spawn(QtConcurrent::FutureResult) |
| QtConcurrent::QTaskBuilder<Task, ExtraArgs...> | withArguments(ExtraArgs &&... args) |
| QtConcurrent::QTaskBuilder<Task, Args...> & | withPriority(int newPriority) |
相关的非成员
成员函数文档
QtConcurrent::QTaskBuilder<Task, Args...> &QTaskBuilder::onThreadPool(QThreadPool &newThreadPool)
设置任务将被调用的线程池newThreadPool 。
QFuture<QtConcurrent::InvokeResultType> QTaskBuilder::spawn()
在单独的线程中运行该任务,并立即返回一个 Future 对象。这是一个非阻塞调用。该任务可能不会立即开始。
void QTaskBuilder::spawn(QtConcurrent::FutureResult)
在单独的线程中运行该任务。这是一个非阻塞调用。该任务可能不会立即开始。
template <typename... ExtraArgs> QtConcurrent::QTaskBuilder<Task, ExtraArgs...> QTaskBuilder::withArguments(ExtraArgs &&... args)
设置任务调用时使用的参数args 。如果出现以下情况,代码格式不正确(会导致编译错误):
- 该函数被调用超过一次。
- 参数个数为零。
QtConcurrent::QTaskBuilder<Task, Args...> &QTaskBuilder::withPriority(int newPriority)
设置任务被调用时的优先级newPriority 。
© 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.