QTextBlock::iterator Class

class QTextBlock ::iterator

The QTextBlock::iterator 類提供迭代器用於讀取內容在 QTextBlock . 更多...

公共函數

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

詳細描述

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);
    }
					

另請參閱 QTextFragment .

成員函數文檔編製

[constexpr noexcept] iterator:: iterator ()

為此文本塊構造迭代器。

bool iterator:: atEnd () const

返迴 true 若當前項是文本塊的最後項。

QTextFragment iterator:: fragment () const

返迴迭代器目前指嚮的文本片段。

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

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

QTextBlock::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.

QTextBlock::iterator iterator:: operator++ ( 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.

QTextBlock::iterator &iterator:: operator-- ()

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

QTextBlock::iterator iterator:: operator-- ( int )

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

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

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