|  | Home · All Classes · Modules

# QPlainTextDocumentLayout Class Reference
[QtGui module]

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

Inherits QAbstractTextDocumentLayout.

### Methods

- __init__ (self, QTextDocument document)
- QRectF blockBoundingRect (self, QTextBlock block)
- int cursorWidth (self)
- documentChanged (self, int from, int, int charsAdded)
- QSizeF documentSize (self)
- draw (self, QPainter, QAbstractTextDocumentLayout.PaintContext)
- ensureBlockLayout (self, QTextBlock block)
- QRectF frameBoundingRect (self, QTextFrame)
- int hitTest (self, QPointF, Qt.HitTestAccuracy)
- int pageCount (self)
- requestUpdate (self)
- setCursorWidth (self, int width)

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

## Method Documentation

### QPlainTextDocumentLayout.__init__ (self, QTextDocument document)

Constructs a plain text document layout for the text document.

### QRectF QPlainTextDocumentLayout.blockBoundingRect (self, QTextBlock block)

### int QPlainTextDocumentLayout.cursorWidth (self)

### QPlainTextDocumentLayout.documentChanged (self, int from, int, int charsAdded)

### QSizeF QPlainTextDocumentLayout.documentSize (self)

### QPlainTextDocumentLayout.draw (self, QPainter, QAbstractTextDocumentLayout.PaintContext)

### QPlainTextDocumentLayout.ensureBlockLayout (self, QTextBlock block)

Ensures that block has a valid layout

### QRectF QPlainTextDocumentLayout.frameBoundingRect (self, QTextFrame)

### int QPlainTextDocumentLayout.hitTest (self, QPointF, Qt.HitTestAccuracy)

### int QPlainTextDocumentLayout.pageCount (self)

### QPlainTextDocumentLayout.requestUpdate (self)

Requests a complete update on all views.

### QPlainTextDocumentLayout.setCursorWidth (self, int width)