|  | Home · Overviews · Examples

# QTreeWidgetItemIterator Class Reference
[com.trolltech.qt.gui module]

The `QTreeWidgetItemIterator` class provides a way to iterate over the items in a `QTreeWidget` instance. More...

## Detailed Description

The `QTreeWidgetItemIterator` class provides a way to iterate over the items in a `QTreeWidget` instance.

The iterator will walk the items in a pre-order traversal order, thus visiting the parent node before it continues to the child nodes.

For example, the following code examples each item in a tree, checking the text in the first column against a user-specified search string:

            QTreeWidgetItemIterator it(treeWidget);
            while (*it) {
                if ((*it)->text(0) == itemText)
                    treeWidget->setItemSelected(*it, true);
                ++it;
            }

It is also possible to filter out certain types of node by passing certain flags to the constructor of `QTreeWidgetItemIterator`.

See also `QTreeWidget`, Model/View Programming, and `QTreeWidgetItem`.