Table Of Contents

Previous topic

QTreeWidgetItem

Next topic

QTableWidgetItem

QTreeWidgetItemIterator

Inheritance diagram of QTreeWidgetItemIterator

Synopsis

Functions

Detailed Description

The PySide.QtGui.QTreeWidgetItemIterator class provides a way to iterate over the items in a PySide.QtGui.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:

it = QTreeWidgetItemIterator(treeWidget)
while it:
    if it.text(0) == itemText:
        *it.setSelected(True)
    ++it

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

See also

PySide.QtGui.QTreeWidget Model/View Programming PySide.QtGui.QTreeWidgetItem

class PySide.QtGui.QTreeWidgetItemIterator(widget[, flags=QTreeWidgetItemIterator.All])
class PySide.QtGui.QTreeWidgetItemIterator(item[, flags=QTreeWidgetItemIterator.All])
class PySide.QtGui.QTreeWidgetItemIterator(it)
Parameters:

Constructs an iterator for the same PySide.QtGui.QTreeWidget as it . The current iterator item is set to point on the current item of it .

PySide.QtGui.QTreeWidgetItemIterator.IteratorFlag

These flags can be passed to a PySide.QtGui.QTreeWidgetItemIterator constructor (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  
PySide.QtGui.QTreeWidgetItemIterator.__iter__()
Return type:PyObject
PySide.QtGui.QTreeWidgetItemIterator.__next__()
Return type:PyObject
PySide.QtGui.QTreeWidgetItemIterator.matchesFlags(item)
Parameters:itemPySide.QtGui.QTreeWidgetItem
Return type:PySide.QtCore.bool
PySide.QtGui.QTreeWidgetItemIterator.__iadd__(n)
Parameters:nPySide.QtCore.int
Return type:PySide.QtGui.QTreeWidgetItemIterator

Makes the iterator go forward by n matching 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 0. Returns the resulting iterator.

PySide.QtGui.QTreeWidgetItemIterator.__isub__(n)
Parameters:nPySide.QtCore.int
Return type:PySide.QtGui.QTreeWidgetItemIterator

Makes the iterator go backward by n matching 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 0. Returns the resulting iterator.

PySide.QtGui.QTreeWidgetItemIterator.value()
Return type:PySide.QtGui.QTreeWidgetItem