|  | Home · All Classes · Modules

# QTextBlock.iterator Class Reference
[QtGui module]

The QTextBlock.iterator class provides an iterator for reading the contents of a QTextBlock. More...

### Methods

- __init__ (self)
- __init__ (self, iterator o)
- bool atEnd (self)
- QTextFragment fragment (self)

### Special Methods

- bool __eq__ (self, iterator o)
- iterator __iadd__ (self, int)
- iterator __isub__ (self, int)
- bool __ne__ (self, iterator o)

## Detailed Description

The QTextBlock.iterator class provides an iterator for reading the contents of a QTextBlock.

A block consists of a sequence of text fragments. This class provides a way to iterate over these, and read their contents. It does not provide a way to modify the internal structure or contents of the block.

An iterator can be constructed and used to access the fragments within a text block in the following way:

         QTextBlock.iterator it;
         for (it = currentBlock.begin(); !(it.atEnd()); ++it) {
             QTextFragment currentFragment = it.fragment();
             if (currentFragment.isValid())
                 processFragment(currentFragment);
         }

## Method Documentation

### iterator.__init__ (self)

Constructs an iterator for this text block.

### iterator.__init__ (self, iterator o)

### bool iterator.atEnd (self)

Returns true if the current item is the last item in the text block.

### QTextFragment iterator.fragment (self)

Returns the text fragment the iterator currently points to.

### bool iterator.__eq__ (self, iterator o)

### iterator iterator.__iadd__ (self, int)

### iterator iterator.__isub__ (self, int)

### bool iterator.__ne__ (self, iterator o)