- Qt 6.12
- Qt TaskTree
- C++ Classes
- For
- Qt 6.12.0 Reference Documentation

# QtTaskTree::For Class

class QtTaskTree::For

A for loop element. More...

Header: | `#include <qtasktree.h>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS TaskTree)` `target_link_libraries(mytarget PRIVATE Qt6::TaskTree)`
qmake: | `QT += tasktree`
Since: | Qt 6.11
Status: | Technology preview

This class is in technology preview and is subject to change.

- List of all members, including inherited members

Note: All functions in this class are reentrant.

## Public Functions

| For(const QtTaskTree::Iterator &iterator)
| For(qsizetype count)
| For(QtTaskTree::For &&other)

## Related Non-Members

QtTaskTree::Group | operator>>(const QtTaskTree::For &forItem, const QtTaskTree::Do &doItem)

## Detailed Description

A for element, holding an iterator, enabling loop constructs like:

     For (RepeatIterator(5)) >> Do {
         task1,
         task2
     }

See also Iterator and Do.

## Member Function Documentation

### `[explicit]` For::For(const QtTaskTree::Iterator &iterator)

Constructs the For loop element, holding an iterator. Use the stream insertion operator with Do element to place the whole construct in a task tree recipe.

### `[explicit]` For::For(qsizetype count)

Constructs the For loop element, repeating count times.

This is equivalent to:

     For (RepeatIterator(count))

This is an overloaded function.

See also RepeatIterator.

### `[constexpr noexcept default]` For::For(QtTaskTree::For &&other)

Move-constructs an instance of For.

## Related Non-Members

### QtTaskTree::Group operator>>(const QtTaskTree::For &forItem, const QtTaskTree::Do &doItem)

Combines forItem with doItem body and returns a Group ready to be used in task tree recipes.