Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

QTextBlock Class Reference

The QTextBlock class provides an API for accessing the block structure of QTextDocuments. More...

#include <QTextBlock>

List of all members.

Public Types

Public Functions


Detailed Description

The QTextBlock class provides an API for accessing the block structure of QTextDocuments.

A QTextBlock is an object that provides read-only access to the block/paragraph structure of QTextDocuments. It is mainly of use if you want to implement your own layouts for the visual representation of a QTextDocument, or if you want to iterate over a document and output its contents in your own custom format.

The text block has a position() in the document, a length(), a text layout(), a charFormat(), a blockFormat(), and a text(). And it belongs to a document(). Navigation between blocks can be done using next() and previous().


Member Type Documentation

typedef QTextBlock::Iterator


Member Function Documentation

QTextBlock::QTextBlock ( const QTextBlock & other )

Copies the other text block's attributes to this text block.

iterator QTextBlock::begin () const

Returns a text block iterator pointing to the beginning of the text block.

See also end().

QTextBlockFormat QTextBlock::blockFormat () const

Returns the QTextBlockFormat that describes block-specific properties.

See also charFormat().

QTextCharFormat QTextBlock::charFormat () const

Returns the QTextCharFormat that describes the block's character format. This is mainly used to draw block-specific additions such as e.g. list markers.

See also blockFormat().

bool QTextBlock::contains ( int position ) const

Returns true if the given position is located within the text block; otherwise returns false.

const QTextDocument * QTextBlock::document () const

Returns the text document this text block belongs to, or 0 if the text block doesn't belong to any document.

iterator QTextBlock::end () const

Returns a text block iterator pointing to the end of the text block.

See also begin(), next(), and previous().

bool QTextBlock::isValid () const

Returns true if this text block is valid; otherwise returns false.

QTextLayout * QTextBlock::layout () const

Returns the QTextLayout that is used to lay out and display the block's contents.

int QTextBlock::length () const

Returns the length of the block in characters.

See also text(), charFormat(), and blockFormat().

QTextBlock QTextBlock::next () const

Returns the text block after this one, or an empty text block if this is the last one.

See also previous(), begin(), end(), and next().

int QTextBlock::position () const

Returns the starting position of the block within the document.

QTextBlock QTextBlock::previous () const

Returns the text block before this one, or an empty text block if this is the first one.

See also next(), begin(), end(), and previous().

QString QTextBlock::text () const

Returns the block's plain text.

See also length(), charFormat(), and blockFormat().

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

Returns true if this text block is different from the other text block.

bool QTextBlock::operator< ( const QTextBlock & other ) const

Returns true if this text block occurs before the other text block in the document.

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

Assigns the other text block to this text block.

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

Returns true if this text block is the same as the other text block.


Copyright © 2004 Trolltech. Trademarks
Qt 4.0.0-tp1