CopperSpice API  1.9.2
QTextBlock::iterator Class Reference

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

Public Methods

 iterator ()
 
 iterator (const iterator &other) = default
 
 iterator (iterator &&other) = default
 
bool atEnd () const
 
QTextFragment fragment () const
 
bool operator!= (const iterator &other) const
 
iterator & operator++ ()
 
iterator operator++ (int)
 
iterator & operator-- ()
 
iterator operator-- (int)
 
iterator & operator= (const iterator &other) = default
 
iterator & operator= (iterator &&other) = default
 
bool operator== (const iterator &other) const
 

Friends

class 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 blocks 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 example.

for (iter = currentBlock.begin(); ! (iter.atEnd()); ++iter) {
QTextFragment currentFragment = iter.fragment();
if (currentFragment.isValid()) {
processFragment(currentFragment);
}
}
See also
QTextFragment

Constructor & Destructor Documentation

QTextBlock::iterator::iterator ( )
inline

Constructs an iterator for this QTextBlock.

QTextBlock::iterator::iterator ( const iterator &  other)
default

Copy constructs a new QTextBlock::iterator from other.

QTextBlock::iterator::iterator ( iterator &&  other)
default

Move constructs a new QTextBlock::iterator from other.

Method Documentation

bool QTextBlock::iterator::atEnd ( ) const
inline

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

QTextFragment QTextBlock::iterator::fragment ( ) const

Returns the text fragment the iterator currently points to.

bool QTextBlock::iterator::operator!= ( const iterator &  other) const
inline

Returns true if this iterator is different from the other iterator, otherwise returns false.

iterator & QTextBlock::iterator::operator++ ( )

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

++iter;
iterator QTextBlock::iterator::operator++ ( int  )
inline

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

iter++;
iterator & QTextBlock::iterator::operator-- ( )

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

--iter;
iterator QTextBlock::iterator::operator-- ( int  )
inline

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

iter--;
iterator & QTextBlock::iterator::operator= ( const iterator &  other)
default

Copy assigns from other and returns a reference to this object.

iterator & QTextBlock::iterator::operator= ( iterator &&  other)
default

Move assigns from other and returns a reference to this object.

bool QTextBlock::iterator::operator== ( const iterator &  other) const
inline

Returns true if this iterator is the same as the other iterator, otherwise returns false.