Qt 4.8
|
The QTreeWidgetItemIterator class provides a way to iterate over the items in a QTreeWidget instance. More...
#include <qtreewidgetitemiterator.h>
Public Types | |
enum | IteratorFlag { All = 0x00000000, Hidden = 0x00000001, NotHidden = 0x00000002, Selected = 0x00000004, Unselected = 0x00000008, Selectable = 0x00000010, NotSelectable = 0x00000020, DragEnabled = 0x00000040, DragDisabled = 0x00000080, DropEnabled = 0x00000100, DropDisabled = 0x00000200, HasChildren = 0x00000400, NoChildren = 0x00000800, Checked = 0x00001000, NotChecked = 0x00002000, Enabled = 0x00004000, Disabled = 0x00008000, Editable = 0x00010000, NotEditable = 0x00020000, UserFlag = 0x01000000 } |
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. More... | |
Public Functions | |
QTreeWidgetItem * | operator* () const |
Dereference operator. More... | |
QTreeWidgetItemIterator & | operator++ () |
The prefix ++ operator (++it) advances the iterator to the next matching item and returns a reference to the resulting iterator. More... | |
const QTreeWidgetItemIterator | operator++ (int) |
The postfix ++ operator (it++) advances the iterator to the next matching item and returns an iterator to the previously current item. More... | |
QTreeWidgetItemIterator & | operator+= (int n) |
Makes the iterator go forward by n matching items. More... | |
QTreeWidgetItemIterator & | operator-- () |
The prefix – operator (–it) advances the iterator to the previous matching item and returns a reference to the resulting iterator. More... | |
const QTreeWidgetItemIterator | operator-- (int) |
The postfix – operator (it–) makes the preceding matching item current and returns an iterator to the previously current item. More... | |
QTreeWidgetItemIterator & | operator-= (int n) |
Makes the iterator go backward by n matching items. More... | |
QTreeWidgetItemIterator & | operator= (const QTreeWidgetItemIterator &it) |
Assignment. More... | |
QTreeWidgetItemIterator (const QTreeWidgetItemIterator &it) | |
Constructs an iterator for the same QTreeWidget as it. More... | |
QTreeWidgetItemIterator (QTreeWidget *widget, IteratorFlags flags=All) | |
Constructs an iterator for the given widget that uses the specified flags to determine which items are found during iteration. More... | |
QTreeWidgetItemIterator (QTreeWidgetItem *item, IteratorFlags flags=All) | |
Constructs an iterator for the given item that uses the specified flags to determine which items are found during iteration. More... | |
~QTreeWidgetItemIterator () | |
Destroys the iterator. More... | |
Private Functions | |
bool | matchesFlags (const QTreeWidgetItem *item) const |
Properties | |
QTreeWidgetItem * | current |
QScopedPointer< QTreeWidgetItemIteratorPrivate > | d_ptr |
IteratorFlags | flags |
Friends | |
class | QTreeModel |
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:
It is also possible to filter out certain types of node by passing certain flags to the constructor of QTreeWidgetItemIterator.
Definition at line 61 of file qtreewidgetitemiterator.h.
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.
Definition at line 66 of file qtreewidgetitemiterator.h.
QTreeWidgetItemIterator::QTreeWidgetItemIterator | ( | const 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.
Definition at line 79 of file qtreewidgetitemiterator.cpp.
Referenced by QTreeWidgetItemIteratorPrivate::ensureValidIterator().
|
explicit |
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.
Definition at line 97 of file qtreewidgetitemiterator.cpp.
|
explicit |
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.
Definition at line 119 of file qtreewidgetitemiterator.cpp.
QTreeWidgetItemIterator::~QTreeWidgetItemIterator | ( | ) |
Destroys the iterator.
Definition at line 152 of file qtreewidgetitemiterator.cpp.
|
private |
Definition at line 208 of file qtreewidgetitemiterator.cpp.
Referenced by operator++(), operator--(), and QTreeWidgetItemIterator().
|
inline |
Dereference operator.
Returns a pointer to the current item.
Definition at line 147 of file qtreewidgetitemiterator.h.
QTreeWidgetItemIterator & QTreeWidgetItemIterator::operator++ | ( | ) |
The prefix ++ operator (++it) advances the iterator to the next matching item and returns a reference to the resulting iterator.
Sets the current pointer to 0 if the current item is the last matching item.
Definition at line 181 of file qtreewidgetitemiterator.cpp.
|
inline |
The postfix ++ operator (it++) advances the iterator to the next matching item and returns an iterator to the previously current item.
Definition at line 115 of file qtreewidgetitemiterator.h.
|
inline |
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.
Definition at line 129 of file qtreewidgetitemiterator.h.
QTreeWidgetItemIterator & QTreeWidgetItemIterator::operator-- | ( | ) |
The prefix – operator (–it) advances the iterator to the previous matching item and returns a reference to the resulting iterator.
Sets the current pointer to 0 if the current item is the first matching item.
Definition at line 196 of file qtreewidgetitemiterator.cpp.
|
inline |
The postfix – operator (it–) makes the preceding matching item current and returns an iterator to the previously current item.
Definition at line 122 of file qtreewidgetitemiterator.h.
|
inline |
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.
Definition at line 138 of file qtreewidgetitemiterator.h.
QTreeWidgetItemIterator & QTreeWidgetItemIterator::operator= | ( | const QTreeWidgetItemIterator & | it | ) |
Assignment.
Makes a copy of it and returns a reference to its iterator.
Definition at line 162 of file qtreewidgetitemiterator.cpp.
|
friend |
Definition at line 63 of file qtreewidgetitemiterator.h.
|
private |
Definition at line 110 of file qtreewidgetitemiterator.h.
Referenced by operator++(), operator--(), operator=(), and QTreeWidgetItemIterator().
|
private |
Definition at line 109 of file qtreewidgetitemiterator.h.
Referenced by QTreeWidgetItemIterator().
|
private |
Definition at line 111 of file qtreewidgetitemiterator.h.
Referenced by matchesFlags(), and operator=().