iterator Class Reference

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

  1. #include <QTextBlock>

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:

  1.     QTextBlock::iterator it;
  2.     for (it = currentBlock.begin(); !(it.atEnd()); ++it)  {
  3.         QTextFragment currentFragment = it.fragment();
  4.         if (currentFragment.isValid())
  5.             processFragment(currentFragment);
  6.     }

See also QTextFragment.

Public Functions

Toggle details QTextBlock::iterator

iteratoriterator () ()

Constructs an iterator for this text block.

Look up this member in the source code.

Toggle details QTextBlock::iterator

iteratoriterator ( const iterator &other ) ( const iterator &other )

Copy constructor. Constructs a copy of the other iterator.

Look up this member in the source code.

Toggle details bool QTextBlock::iterator

atEndatEnd () ()const

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

Look up this member in the source code.

Toggle details QTextFragment QTextBlock::iterator

fragmentfragment () ()const

Returns the text fragment the iterator currently points to.

Look up this member in the source code.

Toggle details bool QTextBlock::iterator

operator!=operator!= ( const iterator &other ) ( const iterator &other )const

Retuns true if this iterator is different from the other iterator; otherwise returns false.

Look up this member in the source code.

Toggle details iterator & QTextBlock::iterator

operator++operator++ () ()

The prefix ++ operator (++i) advances the iterator to the next item in the hash and returns an iterator to the new current item.

Look up this member in the source code.

Toggle details iterator QTextBlock::iterator

operator++operator++ ( int ) ( int )

The postfix ++ operator (i++) advances the iterator to the next item in the text block and returns an iterator to the old current item.

Look up this member in the source code.

Toggle details iterator & QTextBlock::iterator

operator--operator-- () ()

The prefix -- operator (--i) makes the preceding item current and returns an iterator pointing to the new current item.

Look up this member in the source code.

Toggle details iterator QTextBlock::iterator

operator--operator-- ( int ) ( int )

The postfix -- operator (i--) makes the preceding item current and returns an iterator to the old current item.

Look up this member in the source code.

Toggle details bool QTextBlock::iterator

operator==operator== ( const iterator &other ) ( const iterator &other )const

Retuns true if this iterator is the same as the other iterator; otherwise returns false.

Look up this member in the source code.

    Notes provided by the Qt Community

    No notes