QtTaskTree::If Class
class QtTaskTree::If조건식 표현식에 사용되는 "if" 요소입니다. 더 보기...
| 헤더: | #include <qconditional.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS TaskTree)target_link_libraries(mytarget PRIVATE Qt6::TaskTree) |
| qmake: | QT += tasktree |
| 이후: | Qt 6.11 |
참고: 이 클래스의 모든 함수는 재진입됩니다.
공용 함수
상세 설명
조건 표현식의 초기 조건 요소입니다. 항상 Then 요소가 뒤에 와야 합니다.
TaskTree 모듈의 조건 표현식은 분기 조건과 그 본문을 비동기 방식으로 처리할 수 있습니다. 예를 들어
const Group recipe { If (conditionTask1) >> Then { bodyTask1 } >> ElseIf (conditionTask2) >> Then { bodyTask2 } >> Else { bodyTask3 } };
위의 레시피가 QTaskTree 로 실행되면 태스크 트리는 비동기 conditionTask1 을 먼저 시작합니다. 완료된 후 결과에 따라 태스크 트리는 conditionTask1 이 성공적으로 완료되면 bodyTask1 을 실행하거나, 그렇지 않으면 conditionTask2 을 실행하여 다른 조건을 발송할 수 있습니다. bodyTask1 가 실행된 경우 다른 태스크는 실행되지 않으며 bodyTask1 의 결과가 전체 조건 표현식의 최종 결과입니다.
멤버 함수 문서
[explicit] If::If(const QtTaskTree::ExecutableItem &condition)
조건 표현식에 사용할 condition 작업으로 초기 조건 요소를 만듭니다. 실행 중인 QTaskTree 은 전달된 condition 을 먼저 실행하고, 완료된 후 Then 브랜치가 실행되거나(성공 시), 그렇지 않으면 선택적으로 Else 브랜치 또는 ElseIf 조건이 제공됩니다.
전달된 condition 은 Group 요소로 묶인 여러 작업으로 구성될 수도 있고, 연결 또는 분리처럼 여러 작업의 연결 또는 분리일 수도 있습니다:
const Group subRecipe { parallel, parallelConditionTask1, parallelConditionTask2 }; const Group recipe { If (conditionTask1 && !conditionTask2) >> Then { bodyTask1 } >> ElseIf (subRecipe) >> Then { bodyTask2 } >> Else { bodyTask3 } };
[explicit] template <typename Handler, std::enable_if_t<!std::is_base_of_v<ExecutableItem, std::decay_t<Handler>>, bool> = true> If::If(Handler &&handler)
실행 중인 QTaskTree 에서 초기 조건을 평가할 때 실행할 동기식 handler 을 수락하는 도우미 생성자.
에 대한 바로 가기입니다:
If (QSyncTask(handler))허용되는 핸들러 유형에 대한 자세한 내용은 QSyncTask 을 참조하세요.
이 함수는 오버로드된 함수입니다.
© 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.