Qt Reference Documentation

# QPlainTextDocumentLayout Class Reference

The QPlainTextDocumentLayout class implements a plain text layout for QTextDocument More...

     #include <QPlainTextDocumentLayout>

Inherits: QAbstractTextDocumentLayout.

This class was introduced in Qt 4.4.

- List of all members, including inherited members

## Properties

- cursorWidth : int

- 1 property inherited from QObject

## Public Functions

| QPlainTextDocumentLayout ( QTextDocument * document )
| ~QPlainTextDocumentLayout ()
int | cursorWidth () const
void | ensureBlockLayout ( const QTextBlock & block ) const
void | requestUpdate ()
void | setCursorWidth ( int width )

## Reimplemented Public Functions

virtual QRectF | blockBoundingRect ( const QTextBlock & block ) const
virtual QSizeF | documentSize () const
virtual void | draw ( QPainter *, const PaintContext & )
virtual QRectF | frameBoundingRect ( QTextFrame * ) const
virtual int | hitTest ( const QPointF &, Qt::HitTestAccuracy ) const
virtual int | pageCount () const

- 12 public functions inherited from QAbstractTextDocumentLayout
- 29 public functions inherited from QObject

## Reimplemented Protected Functions

virtual void | documentChanged ( int from, int charsRemoved, int charsAdded )

- 5 protected functions inherited from QAbstractTextDocumentLayout
- 8 protected functions inherited from QObject

### Additional Inherited Members

- 1 public slot inherited from QObject
- 4 signals inherited from QAbstractTextDocumentLayout
- 1 signal inherited from QObject
- 7 static public members inherited from QObject
- 5 protected functions inherited from QAbstractTextDocumentLayout
- 8 protected functions inherited from QObject

## Detailed Description

The QPlainTextDocumentLayout class implements a plain text layout for QTextDocument

A QPlainTextDocumentLayout is required for text documents that can be display or edited in a QPlainTextEdit. See QTextDocument::setDocumentLayout().

QPlainTextDocumentLayout uses the QAbstractTextDocumentLayout API that QTextDocument requires, but redefines it partially in order to support plain text better. For instances, it does not operate on vertical pixels, but on paragraphs (called blocks) instead. The height of a document is identical to the number of paragraphs it contains. The layout also doesn't support tables or nested frames, or any sort of advanced text layout that goes beyond a list of paragraphs with syntax highlighting.

## Property Documentation

### cursorWidth : int

This property specifies the width of the cursor in pixels. The default value is 1.

Access functions:

int | cursorWidth () const
void | setCursorWidth ( int width )

## Member Function Documentation

### QPlainTextDocumentLayout::QPlainTextDocumentLayout ( QTextDocument * document )

Constructs a plain text document layout for the text document.

### QPlainTextDocumentLayout::~QPlainTextDocumentLayout ()

Destructs a plain text document layout.

### QRectF QPlainTextDocumentLayout::blockBoundingRect ( const QTextBlock & block ) const`[virtual]`

Reimplemented from QAbstractTextDocumentLayout::blockBoundingRect().

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

Reimplemented from QAbstractTextDocumentLayout::documentChanged().

### QSizeF QPlainTextDocumentLayout::documentSize () const`[virtual]`

Reimplemented from QAbstractTextDocumentLayout::documentSize().

### void QPlainTextDocumentLayout::draw ( QPainter *, const PaintContext & )`[virtual]`

Reimplemented from QAbstractTextDocumentLayout::draw().

### void QPlainTextDocumentLayout::ensureBlockLayout ( const QTextBlock & block ) const

Ensures that block has a valid layout

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

Reimplemented from QAbstractTextDocumentLayout::frameBoundingRect().

### int QPlainTextDocumentLayout::hitTest ( const QPointF &, Qt::HitTestAccuracy ) const`[virtual]`

Reimplemented from QAbstractTextDocumentLayout::hitTest().

### int QPlainTextDocumentLayout::pageCount () const`[virtual]`

Reimplemented from QAbstractTextDocumentLayout::pageCount().

### void QPlainTextDocumentLayout::requestUpdate ()

Requests a complete update on all views.