QtTaskTree::QSyncTask Class
class QtTaskTree::QSyncTask다른 작업들 사이에서 사용자 정의 핸들러를 동기식으로 실행합니다. 더 보기...
| 헤더: | #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 |
| 상태: | 기술 미리 보기 |
이 클래스는 기술 미리보기 단계에 있으며 변경될 수 있습니다.
참고: 이 클래스의 모든 함수는 재진입 가능합니다.
공개 함수
| QSyncTask(Handler &&handler) |
상세 설명
QSyncTask는 다른 작업들 사이에서 추가 핸들러를 실행하려는 경우에 유용합니다. QSyncTask는 부모 Group 에 의해 다른 작업과 마찬가지로 인식됩니다. QSyncTask의 핸들러 본문은 호출자 스레드에서 동기식으로 실행되므로, 장시간 실행되는 것은 피하십시오. 부득이하게 장시간 실행해야 하는 경우, 대신 QThreadFunctionTask 를 사용하는 것을 고려하십시오.
멤버 함수 문서
[explicit] template <typename Handler, std::enable_if_t<!std::is_same_v<q20::remove_cvref_t<Handler>, QSyncTask>, bool> = true> QSyncTask::QSyncTask(Handler &&handler)
전달된 ` handler `를 동기적으로 실행하는 요소를 생성합니다. ` Handler `는 ` std::function<DoneResult()> ` 유형입니다. ` handler`에서 반환되는 ` DoneResult ` 값은 상위 그룹의 ` workflow policy ` 해결 과정에서 고려됩니다. 선택적으로, ` std::function<void()> `의 축약형도 허용됩니다. 이 경우 반환 값은 ` DoneResult::Success`로 간주됩니다.
전달된 handler 는 호출자 스레드에서 동기적으로 실행되므로, 핸들러 본문의 실행 시간이 길어지지 않도록 주의하십시오. 그렇지 않은 경우, QThreadFunctionTask 의 사용을 고려하십시오.
참고: QSyncTask요소는 태스크 트리 진행 상황을 보고할 때 태스크로 계산되지 않으며, QTaskTree::taskCount() 또는 QTaskTree::progressMaximum()에도 포함되지 않습니다.
© 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.