QPlainTextDocumentLayout 类

The QPlainTextDocumentLayout class implements a plain text layout for QTextDocument 更多...

头: #include <QPlainTextDocumentLayout>
qmake: QT += widgets
Since: Qt 4.4
继承: QAbstractTextDocumentLayout

特性

公共函数

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

重实现公共函数

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

重实现保护函数

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

额外继承成员

详细描述

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 。见 QTextDocument::setDocumentLayout ().

QPlainTextDocumentLayout 使用 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.

特性文档编制

cursorWidth : int

此特性指定光标的宽度 (以像素为单位)。默认值为 1。

访问函数:

int cursorWidth () const
void setCursorWidth (int width )

成员函数文档编制

QPlainTextDocumentLayout:: QPlainTextDocumentLayout ( QTextDocument * document )

构造纯文本文档布局为文本 document .

QPlainTextDocumentLayout:: ~QPlainTextDocumentLayout ()

销毁纯文本文档布局。

[虚拟] QRectF QPlainTextDocumentLayout:: blockBoundingRect (const QTextBlock & block ) const

重实现自 QAbstractTextDocumentLayout::blockBoundingRect ().

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

重实现自 QAbstractTextDocumentLayout::documentChanged ().

[虚拟] QSizeF QPlainTextDocumentLayout:: documentSize () const

重实现自 QAbstractTextDocumentLayout::documentSize ().

[虚拟] void QPlainTextDocumentLayout:: draw ( QPainter * , const PaintContext & )

重实现自 QAbstractTextDocumentLayout::draw ().

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

Ensures that block has a valid layout

[虚拟] QRectF QPlainTextDocumentLayout:: frameBoundingRect ( QTextFrame * ) const

重实现自 QAbstractTextDocumentLayout::frameBoundingRect ().

[虚拟] int QPlainTextDocumentLayout:: hitTest ( const QPointF & , Qt::HitTestAccuracy ) const

重实现自 QAbstractTextDocumentLayout::hitTest ().

[虚拟] int QPlainTextDocumentLayout:: pageCount () const

重实现自 QAbstractTextDocumentLayout::pageCount ().

void QPlainTextDocumentLayout:: requestUpdate ()

请求对所有视图,进行完整更新。