PySide6.QtWidgets.QTreeWidgetItemIterator¶
- class QTreeWidgetItemIterator¶
- The - QTreeWidgetItemIteratorclass provides a way to iterate over the items in a- QTreeWidgetinstance. More…- Synopsis¶- Methods¶- def - __init__()
- def - __iter__()
- def - __next__()
- def - __iadd__()
- def - __isub__()
- def - value()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- Warning - This section contains snippets that were automatically translated from C++ to Python and may contain errors. - 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: - it = QTreeWidgetItemIterator(treeWidget) while it: if (it).text(0) == itemText: (it).setSelected(True) it += 1 - It is also possible to filter out certain types of node by passing certain - flagsto the constructor of- QTreeWidgetItemIterator.- class IteratorFlag¶
- (inherits - enum.Flag) These flags can be passed to a- QTreeWidgetItemIteratorconstructor (OR-ed together if more than one is used), so that the iterator will only iterate over items that match the given flags.- Constant - Description - QTreeWidgetItemIterator.All - QTreeWidgetItemIterator.Hidden - QTreeWidgetItemIterator.NotHidden - QTreeWidgetItemIterator.Selected - QTreeWidgetItemIterator.Unselected - QTreeWidgetItemIterator.Selectable - QTreeWidgetItemIterator.NotSelectable - QTreeWidgetItemIterator.DragEnabled - QTreeWidgetItemIterator.DragDisabled - QTreeWidgetItemIterator.DropEnabled - QTreeWidgetItemIterator.DropDisabled - QTreeWidgetItemIterator.HasChildren - QTreeWidgetItemIterator.NoChildren - QTreeWidgetItemIterator.Checked - QTreeWidgetItemIterator.NotChecked - QTreeWidgetItemIterator.Enabled - QTreeWidgetItemIterator.Disabled - QTreeWidgetItemIterator.Editable - QTreeWidgetItemIterator.NotEditable - QTreeWidgetItemIterator.UserFlag 
 - __init__(it)¶
- Parameters:
 
 - Constructs an iterator for the same - QTreeWidgetas- it. The current iterator item is set to point on the current item of- it.- __init__(widget[, flags=QTreeWidgetItemIterator.IteratorFlag.All])
- Parameters:
- widget – - QTreeWidget
- flags – Combination of - IteratorFlag
 
 
 - Constructs an iterator for the given - widgetthat uses the specified- flagsto determine which items are found during iteration. The iterator is set to point to the first top-level item contained in the widget, or the next matching item if the top-level item doesn’t match the flags.- See also - __init__(item[, flags=QTreeWidgetItemIterator.IteratorFlag.All])
- Parameters:
- item – - QTreeWidgetItem
- flags – Combination of - IteratorFlag
 
 
 - Constructs an iterator for the given - itemthat uses the specified- flagsto determine which items are found during iteration. The iterator is set to point to- item, or the next matching item if- itemdoesn’t match the flags.- See also - __iter__()¶
- Return type:
- object 
 
 - __next__()¶
- Return type:
- object 
 
 - __iadd__(n)¶
- Parameters:
- n – int 
- Return type:
 
 - Makes the iterator go forward by - nmatching items. (If n is negative, the iterator goes backward.)- If the current item is beyond the last item, the current item pointer is set to - None. Returns the resulting iterator.- __isub__(n)¶
- Parameters:
- n – int 
- Return type:
 
 - Makes the iterator go backward by - nmatching items. (If n is negative, the iterator goes forward.)- If the current item is ahead of the last item, the current item pointer is set to - None. Returns the resulting iterator.- value()¶
- Return type: