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

Part of the QtGui module.

Inherits QObject.

- List of all members, including inherited members

### Public Types

- class Selection

### Public Functions

- QAbstractTextDocumentLayout ( QTextDocument * document )
- ~QAbstractTextDocumentLayout ()
- QString anchorAt ( const QPointF & pos ) const
- QTextDocument * document () const
- virtual QSizeF documentSize () const = 0
- virtual void draw ( QPainter * painter, const PaintContext & context ) = 0
- virtual QRectF frameBoundingRect ( QTextFrame * frame ) const
- virtual int hitTest ( const QPointF & point, Qt::HitTestAccuracy accuracy ) const = 0
- virtual int pageCount () const = 0
- QPaintDevice * paintDevice () const
- void setPaintDevice ( QPaintDevice * device )

- 28 public functions inherited from QObject

### Signals

- void documentSizeChanged ( const QSizeF & newSize )
- void pageCountChanged ( int newPages )
- void update ( const QRectF & = QRectF( 0., 0., 1000000000., 1000000000. ) )

- 1 signal inherited from QObject

### Protected Functions

- virtual void documentChanged ( int from, int charsRemoved, int charsAdded ) = 0
- virtual void drawInlineObject ( QPainter * painter, const QRectF & rect, QTextInlineObject object, const QTextFormat & format )
- QTextCharFormat format ( int position )
- virtual void positionInlineObject ( QTextInlineObject item, const QTextFormat & format )
- virtual void resizeInlineObject ( QTextInlineObject item, const QTextFormat & format )

- 7 protected functions inherited from QObject

### Additional Inherited Members

- 1 property inherited from QObject
- 1 public slot inherited from QObject
- 4 static public members inherited from QObject

## 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.

### QAbstractTextDocumentLayout::~QAbstractTextDocumentLayout ()

### QString QAbstractTextDocumentLayout::anchorAt ( const QPointF & pos ) const

### QTextDocument * QAbstractTextDocumentLayout::document () const

Returns the text document that this layout is operating on.

### void QAbstractTextDocumentLayout::documentChanged ( int from, int charsRemoved, int charsAdded ) `[pure virtual protected]`

### QSizeF QAbstractTextDocumentLayout::documentSize () const `[pure virtual]`

### void QAbstractTextDocumentLayout::documentSizeChanged ( const QSizeF & newSize ) `[signal]`

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

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

### void QAbstractTextDocumentLayout::drawInlineObject ( QPainter * painter, const QRectF & rect, QTextInlineObject object, const QTextFormat & format ) `[virtual protected]`

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

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

### QRectF QAbstractTextDocumentLayout::frameBoundingRect ( QTextFrame * frame ) const `[virtual]`

Returns the bounding rectacle of frame .

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

### int QAbstractTextDocumentLayout::pageCount () const `[pure virtual]`

### void QAbstractTextDocumentLayout::pageCountChanged ( int newPages ) `[signal]`

### QPaintDevice * QAbstractTextDocumentLayout::paintDevice () const

### void QAbstractTextDocumentLayout::positionInlineObject ( QTextInlineObject item, const QTextFormat & format ) `[virtual protected]`

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

See also drawObject().

### void QAbstractTextDocumentLayout::resizeInlineObject ( QTextInlineObject item, const QTextFormat & format ) `[virtual protected]`

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

### void QAbstractTextDocumentLayout::setPaintDevice ( QPaintDevice * device )

### void QAbstractTextDocumentLayout::update ( const QRectF & = QRectF( 0., 0., 1000000000., 1000000000. ) ) `[signal]`