이 페이지에서

QtConcurrent::QTaskBuilder Class

template <typename Task, typename... Args> class QtConcurrent::QTaskBuilder

QTaskBuilder 클래스는 작업 매개변수를 조정하는 데 사용됩니다. 더 보기...

헤더: #include <qtaskbuilder.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS Concurrent)
target_link_libraries(mytarget PRIVATE Qt6::Concurrent)
qmake: QT += concurrent
다음부터: Qt 6.0부터

공개 함수

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)

상세 설명

템플릿 매개 변수 ` Task `는 호출 가능한 유형을 지정하고, ` Args `는 작업이 호출될 때 사용되는 인자 유형을 지정합니다.

이 클래스의 객체를 수동으로 생성할 수는 없습니다. 자세한 내용과 사용 예제는 Concurrent Task를 참조하십시오.

멤버 함수 문서

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 를 설정합니다. 다음의 경우 코드가 잘못된 형식입니다(컴파일 오류가 발생함):

  • 이 함수가 두 번 이상 호출되는 경우.
  • 인수의 개수가 0인 경우.

QtConcurrent::QTaskBuilder<Task, Args...> &QTaskBuilder::withPriority(int newPriority)

작업이 호출될 때 적용될 우선순위 newPriority 를 설정합니다.

관련 비회원

[alias] InvokeResultType

이 유형에 대한 간략한 정의는 다음과 같습니다:

template <class Task, class ...Args>
using InvokeResultType = std::invoke_result_t<std::decay_t<Task>, std::decay_t<Args>...>;

실제 구현에는 지정된 인자로 태스크를 호출할 수 있는지 여부에 대한 컴파일 시점 검사도 포함되어 있습니다.

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