com.trolltech.qt.gui
Class QTreeWidgetItemIterator

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.gui.QTreeWidgetItemIterator
All Implemented Interfaces:
QtJambiInterface, java.lang.Cloneable

public class QTreeWidgetItemIterator
extends QtJambiObject
implements java.lang.Cloneable

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 = new QTreeWidgetItemIterator(treeWidget);
    while (it.current() != null) {
        if (it.current().text(0).equals(itemText))
            treeWidget.setItemSelected(it, true);
        it.next();
    }
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.


Nested Class Summary
static class QTreeWidgetItemIterator.IteratorFlag
          These flags can be passed to a 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.
static class QTreeWidgetItemIterator.IteratorFlags
           
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QTreeWidgetItemIterator(QTreeWidget widget)
          Constructs an iterator for the given widget that uses the specified flags to determine which items are found during iteration.
QTreeWidgetItemIterator(QTreeWidgetItem item)
          Constructs an iterator for the given item that uses the specified flags to determine which items are found during iteration.
QTreeWidgetItemIterator(QTreeWidgetItemIterator it)
          Constructs an iterator for the same QTreeWidget as it.
QTreeWidgetItemIterator(QTreeWidgetItem item, QTreeWidgetItemIterator.IteratorFlag[] flags)
          This is an overloaded method provided for convenience.
QTreeWidgetItemIterator(QTreeWidgetItem item, QTreeWidgetItemIterator.IteratorFlags flags)
          Constructs an iterator for the given widget that uses the specified flags to determine which items are found during iteration.
QTreeWidgetItemIterator(QTreeWidget widget, QTreeWidgetItemIterator.IteratorFlag[] flags)
           
QTreeWidgetItemIterator(QTreeWidget widget, QTreeWidgetItemIterator.IteratorFlags flags)
           
 
Method Summary
 QTreeWidgetItemIterator clone()
          This method is reimplemented for internal reasons
 QTreeWidgetItem current()
          Returns the current item.
 void next()
          Advances the iterator by one item.
 void next(int i)
          This function advances the iterator by i items.
 void previous()
          Makes the iterator go backwards by one item.
 void previous(int i)
          Makes the iterator go backwards by i items.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QTreeWidgetItemIterator

public QTreeWidgetItemIterator(QTreeWidget widget,
                               QTreeWidgetItemIterator.IteratorFlag[] flags)

QTreeWidgetItemIterator

public QTreeWidgetItemIterator(QTreeWidget widget)
Constructs an iterator for the given widget that uses the specified flags to 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:
QTreeWidgetItemIterator::IteratorFlag .


QTreeWidgetItemIterator

public QTreeWidgetItemIterator(QTreeWidget widget,
                               QTreeWidgetItemIterator.IteratorFlags flags)

QTreeWidgetItemIterator

public QTreeWidgetItemIterator(QTreeWidgetItem item,
                               QTreeWidgetItemIterator.IteratorFlag[] flags)
This is an overloaded method provided for convenience.


QTreeWidgetItemIterator

public QTreeWidgetItemIterator(QTreeWidgetItem item)
Constructs an iterator for the given item that uses the specified flags to determine which items are found during iteration. The iterator is set to point to item, or the next matching item if item doesn't match the flags.

See also:
QTreeWidgetItemIterator::IteratorFlag .


QTreeWidgetItemIterator

public QTreeWidgetItemIterator(QTreeWidgetItem item,
                               QTreeWidgetItemIterator.IteratorFlags flags)
Constructs an iterator for the given widget that uses the specified flags to 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:
QTreeWidgetItemIterator::IteratorFlag .


QTreeWidgetItemIterator

public QTreeWidgetItemIterator(QTreeWidgetItemIterator it)
Constructs an iterator for the same QTreeWidget as it. The current iterator item is set to point on the current item of it.

Method Detail

next

public final void next(int i)
This function advances the iterator by i items.


previous

public final void previous(int i)
Makes the iterator go backwards by i items.


next

public final void next()
Advances the iterator by one item.


previous

public final void previous()
Makes the iterator go backwards by one item.


current

public final QTreeWidgetItem current()
Returns the current item.


clone

public QTreeWidgetItemIterator clone()
This method is reimplemented for internal reasons

Overrides:
clone in class java.lang.Object