QPlainTextDocumentLayout 类实现纯文本布局,为 QTextDocument . 更多...
头: | #include <QPlainTextDocumentLayout> |
CMake: |
find_package(Qt6 COMPONENTS Widgets REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
继承: | QAbstractTextDocumentLayout |
QPlainTextDocumentLayout (QTextDocument * document ) | |
virtual | ~QPlainTextDocumentLayout () |
int | cursorWidth () const |
void | ensureBlockLayout (const QTextBlock & block ) const |
void | requestUpdate () |
void | setCursorWidth (int width ) |
virtual QRectF | blockBoundingRect (const QTextBlock & block ) const override |
virtual QSizeF | documentSize () const override |
virtual void | draw (QPainter *, const QAbstractTextDocumentLayout::PaintContext &) override |
virtual QRectF | frameBoundingRect (QTextFrame *) const override |
virtual int | hitTest (const QPointF &, Qt::HitTestAccuracy) const override |
virtual int | pageCount () const override |
virtual void | documentChanged (int from , int charsRemoved , int charsAdded ) override |
A QPlainTextDocumentLayout is required for text documents that can be display or edited in a QPlainTextEdit 。见 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.
此特性指定光标的宽度 (以像素为单位)。默认值为 1。
访问函数:
int | cursorWidth () const |
void | setCursorWidth (int width ) |
构造纯文本文档布局为文本 document .
[虚拟]
QPlainTextDocumentLayout::
~QPlainTextDocumentLayout
()
销毁纯文本文档布局。
[override virtual]
QRectF
QPlainTextDocumentLayout::
blockBoundingRect
(const
QTextBlock
&
block
) const
重实现: QAbstractTextDocumentLayout::blockBoundingRect (const QTextBlock &block) const.
[override virtual protected]
void
QPlainTextDocumentLayout::
documentChanged
(
int
from
,
int
charsRemoved
,
int
charsAdded
)
重实现: QAbstractTextDocumentLayout::documentChanged (int position, int charsRemoved, int charsAdded).
[override virtual]
QSizeF
QPlainTextDocumentLayout::
documentSize
() const
重实现: QAbstractTextDocumentLayout::documentSize () const.
[override virtual]
void
QPlainTextDocumentLayout::
draw
(
QPainter
*, const
QAbstractTextDocumentLayout::PaintContext
&)
重实现: QAbstractTextDocumentLayout::draw (QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context).
Ensures that block has a valid layout
[override virtual]
QRectF
QPlainTextDocumentLayout::
frameBoundingRect
(
QTextFrame
*) const
重实现: QAbstractTextDocumentLayout::frameBoundingRect (QTextFrame *frame) const.
[override virtual]
int
QPlainTextDocumentLayout::
hitTest
(const
QPointF
&,
Qt::HitTestAccuracy
) const
重实现: QAbstractTextDocumentLayout::hitTest (const QPointF &point, Qt::HitTestAccuracy accuracy) 常量。
[override virtual]
int
QPlainTextDocumentLayout::
pageCount
() const
重实现: QAbstractTextDocumentLayout::pageCount () const.
请求对所有视图,进行完整更新。