このページでは

QtTaskTree::UntilIterator Class

class QtTaskTree::UntilIterator

For 要素の内部で使用する条件付きイテレータ。もっと詳しく...

ヘッダー #include <qtasktree.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS TaskTree)
target_link_libraries(mytarget PRIVATE Qt6::TaskTree)
qmake: QT += tasktree
以来:Qt 6.11
継承: QtTaskTree::Iterator

注意:このクラスの関数はすべてリエントラントです。

パブリック関数

UntilIterator(const QtTaskTree::Iterator::Condition &condition)

詳細説明

IteratorForeverIteratorRepeatIteratorListIteratorも参照のこと

メンバ関数のドキュメント

[explicit] UntilIterator::UntilIterator(const QtTaskTree::Iterator::Condition &condition)

For (UntilIterator(condition)) >> Do {} 構造体の条件付きイテレータを構築します。このイテレータは、渡されたcondition が true を返すまで繰り返されます。

使用例:

static const intmaxNumber= 10;const intluckyNumber=().global()->bounded. QRandomGenerator().global()->bounded(maxNumber);
qDebug() << "Today's lucky number is:" << luckyNumber;
qDebug() << "Let's start the drawing...";

const autoonConditionCheck= [luckyNumber](intiteration) {if(iteration== 0)return true;const intdrawnNumber=QRandomGenerator().global()->bounded(maxNumber);    qDebug() << "You have drawn:" << drawnNumber;
   boolwon=drawnNumber==luckyNumber;if(won)        qDebug() << "You have won! Congratulations!";
   return !won; };constGroup recipe=For (UntilIterator(onConditionCheck))>>Do { timeoutTask(1s,DoneResult::Success) };

recipeQTaskTree によって起動されたときに可能な出力:

Today's lucky number is: 7
Let's start the drawing...
You have drawn: 2
You have drawn: 5
You have drawn: 0
You have drawn: 2
You have drawn: 4
You have drawn: 9
You have drawn: 9
You have drawn: 7
You have won! Congratulations!

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