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

QAbstractTextDocumentLayout Class Reference

The QAbstractTextDocumentLayout class is an abstract base class used to implement custom layouts for QTextDocuments. More...

#include <QAbstractTextDocumentLayout>

This class is under development and is subject to change.

Inherits QObject.

Writable Properties

Public Functions

Public Slots

Signals

Static Public Members

Protected Functions


Detailed Description

The QAbstractTextDocumentLayout class is an abstract base class used to implement custom layouts for QTextDocuments.

The standard layout provided by Qt can handle simple word processing including inline layouts, lists and tables.

Some applications (e.g. a word processor or a DTP application) might need more features than the ones provided by Qt's layout engine, in which case you can subclass QAbstractTextDocumentLayout to provide your own custom layout behavior for your text documents.


Member Function Documentation

QAbstractTextDocumentLayout::QAbstractTextDocumentLayout ( QTextDocument * document )

Creates a new text document layout for the given document.

QString QAbstractTextDocumentLayout::anchorAt ( const QPoint & position ) const

Returns the reference of the anchor at the given position, or an empty string if no anchor exists at that point.

QFont QAbstractTextDocumentLayout::defaultFont () const

Returns the default font to be used in the document layout.

const QTextDocument * QAbstractTextDocumentLayout::document () const   [protected]

Returns the text document that this layout is operating on.

void QAbstractTextDocumentLayout::documentChange ( int from, int oldLength, int length )   [pure virtual]

This function is called whenever the contents of the document change. A change is an insertion of text, text removal, or the combination of both. The from argument defines the beginning of the change in the document. The oldLength argument specifies the length of the area that was modified before the actual change, and length is the length afterwards.

For example when simply inserting the text "Hello", oldLength would be 0 and length would equal 5 (the length of the string).

If for example 3 characters get removed, then oldLength would be equal to 3 while length would be 0, as before the change there were 3 characters and afterwards none.

Replacing text is the combination of removal and insertion. For example, if the text "Hello" gets replaced by "Hi", oldLength would be 5 and length would be 2.

void QAbstractTextDocumentLayout::draw ( QPainter * painter, const PaintContext & context )   [pure virtual]

Draws the layout on the given painter with the given context.

void QAbstractTextDocumentLayout::drawObject ( QPainter * painter, const QRectF & rect, QTextInlineObject object, const QTextFormat & format, QTextLayout::SelectionType selection )   [virtual]

QTextCharFormat QAbstractTextDocumentLayout::format ( int position )   [protected]

Returns the character format that is applicable at the given position.

QRect QAbstractTextDocumentLayout::frameBoundingRect ( QTextFrame * frame ) const   [virtual]

Returns the bounding rectacle of frame .

int QAbstractTextDocumentLayout::hitTest ( const QPoint & point, Qt::HitTestAccuracy accuracy ) const   [pure virtual]

void QAbstractTextDocumentLayout::layoutObject ( QTextInlineObject item, const QTextFormat & format )   [virtual]

Lays out the inline object item using the given text format. The base class implementation does nothing.

See also drawObject().

int QAbstractTextDocumentLayout::numPages () const   [pure virtual]

Returns the number of pages required by this layout; this depends in part on the pageSize().

QSize QAbstractTextDocumentLayout::pageSize () const   [pure virtual]

Returns the page size.

See also setPageSize() and numPages().

void QAbstractTextDocumentLayout::setDefaultFont ( const QFont & font )

Sets the default font to use in the document layout.

void QAbstractTextDocumentLayout::setPageSize ( const QSize & size )   [pure virtual]

Sets the page size.

See also pageSize() and numPages().

void QAbstractTextDocumentLayout::setSize ( QTextInlineObject item, const QTextFormat & format )   [virtual]

Sets the size of the inline object item in accordance with the text format.

QSize QAbstractTextDocumentLayout::sizeUsed () const   [virtual]

Returns the size used for the document. The default implementation just calls pageSize(). For example, if your layout is similar to HTML then you may want to re-implement this function, and return the size your document actually used, as that will differ from the page size.

See also setPageSize() and pageSize().

void QAbstractTextDocumentLayout::update ( const QRect & rect = QRect( 0, 0, 0x10000000, 0x10000000 ) )   [signal]

This signal is emitted when the rectangle rect has been updated.


Copyright © 2004 Trolltech Trademarks
Qt 4.0.0-b1