iterator Class
(QTextBlock::iterator)The QTextBlock::iterator class provides an iterator for reading the contents of a QTextBlock. More...
Header: | #include <iterator> |
qmake: | QT += gui |
Public Functions
iterator() | |
iterator(const iterator &o) | |
bool | atEnd() const |
QTextFragment | fragment() const |
bool | operator!=(const iterator &o) const |
iterator & | operator++() |
iterator | operator++(int) |
iterator & | operator--() |
iterator | operator--(int) |
bool | operator==(const iterator &o) const |
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); }
See also QTextFragment.
Member Function Documentation
iterator::iterator()
Default constructs an instance of iterator.
iterator::iterator(const iterator &o)
Default constructs an instance of iterator.
bool iterator::atEnd() const
QTextFragment iterator::fragment() const
Returns the text fragment the iterator currently points to.
bool iterator::operator!=(const iterator &o) const
iterator &iterator::operator++()
The prefix ++ operator (++i
) advances the iterator to the next item in the hash and returns an iterator to the new current item.
iterator iterator::operator++(int)
iterator &iterator::operator--()
The prefix -- operator (--i
) makes the preceding item current and returns an iterator pointing to the new current item.