An iterator which iterates through an Observer tree (thus also Qtilities::CoreGui::TreeNode). More...
#include <TreeIterator.h>
Public Member Functions | |
QObject * | current () const |
Gets the current item in the context iterated through. | |
QObject * | first () |
The first item in the context iterated through. | |
QObject * | last () |
The last item in the context iterated through. | |
QObject * | next () |
The next item in the context iterated through. | |
QObject * | previous () |
The previous item in the context iterated through. | |
void | setCurrent (const QObject *current) |
Sets the current item in the context iterated through. | |
TreeIterator (const Observer *top_node=0, int iterator_id=-1) | |
TreeIterator Constructs a new iterator. | |
Public Member Functions inherited from Qtilities::Core::Interfaces::IIterator< QObject > | |
virtual bool | hasNext () |
Indicates if a next item exists. | |
virtual bool | hasPrevious () |
Indicates if a previous item exists. | |
virtual QObject * | operator++ () |
Prefix increment. | |
virtual QObject * | operator++ (int x) |
Postfix increment. | |
virtual QObject * | operator-- () |
Prefix decrement. | |
virtual QObject * | operator-- (int x) |
Postfix decrement. |
Protected Member Functions | |
const QObject * | findParentNext (const QObject *obj) |
Finds the next parent of an object. | |
const Observer * | findParentNextObserver (const QObject *obj) |
Finds the next parent of an object and cast it to an observer. | |
const QObject * | findParentPrevious (const QObject *obj) |
Finds the previous parent of an object. | |
const Observer * | findParentPreviousObserver (const QObject *obj) |
Finds the previous parent of an object and cast it to an observer. |
An iterator which iterates through an Observer tree (thus also Qtilities::CoreGui::TreeNode).
The TreeIterator allows you to easily iterate over the items in a tree. Take the tree shown below as an example:
Lets build this example tree and iterate over it:
Because Qtilities allows tree items to be attached to multiple trees, TreeIterator needs the ability to iterate through trees where subjects can appear more than once. Lets look at an example:
The above tree is constructed using the code snippet below:
When TreeIterator iterates through this tree two things can happen:
This class was added in Qtilities v1.0.
|
inline |
TreeIterator Constructs a new iterator.
top_node | The top node of the tree on which the iterator should operate. |
Qtilities : Reference Documentation | Back to top |
Copyright © 2009-2013, Jaco Naudé
|