Utils::PlainTextDocumentLayout Class
class Utils::PlainTextDocumentLayoutThe PlainTextDocumentLayout class implements a plain text layout for QTextDocument. More...
| Header: | #include <plaintextedit.h> |
| Inherits: | QAbstractTextDocumentLayout |
Properties
- cursorWidth : int
Public Functions
| PlainTextDocumentLayout(QTextDocument *document) | |
| virtual | ~PlainTextDocumentLayout() |
| int | cursorWidth() const |
| void | requestUpdate() |
| void | setCursorWidth(int width) |
Reimplemented Public Functions
| virtual QSizeF | documentSize() const override |
| virtual void | draw(QPainter *, const QAbstractTextDocumentLayout::PaintContext &) override |
| virtual int | hitTest(const QPointF &, Qt::HitTestAccuracy) const override |
| virtual int | pageCount() const override |
Signals
| void | additionalBlockHeightChanged(const QTextBlock &block, int additionalHeight) |
| void | blockSizeChanged(const QTextBlock &block) |
| void | documentContentsChanged(int from, int charsRemoved, int charsAdded) |
Reimplemented Protected Functions
| virtual void | documentChanged(int from, int charsRemoved, int charsAdded) override |
Detailed Description
A PlainTextDocumentLayout is required for text documents that can be display or edited in a PlainTextEdit. See QTextDocument::setDocumentLayout().
PlainTextDocumentLayout 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
PlainTextDocumentLayout::PlainTextDocumentLayout(QTextDocument *document)
Constructs a plain text document layout for the text document.
[virtual noexcept] PlainTextDocumentLayout::~PlainTextDocumentLayout()
Destructs a plain text document layout.
[signal] void PlainTextDocumentLayout::additionalBlockHeightChanged(const QTextBlock &block, int additionalHeight)
[signal] void PlainTextDocumentLayout::blockSizeChanged(const QTextBlock &block)
[override virtual protected] void PlainTextDocumentLayout::documentChanged(int from, int charsRemoved, int charsAdded)
Reimplements: QAbstractTextDocumentLayout::documentChanged(int position, int charsRemoved, int charsAdded).
[signal] void PlainTextDocumentLayout::documentContentsChanged(int from, int charsRemoved, int charsAdded)
[override virtual] QSizeF PlainTextDocumentLayout::documentSize() const
Reimplements: QAbstractTextDocumentLayout::documentSize() const.
[override virtual] void PlainTextDocumentLayout::draw(QPainter *, const QAbstractTextDocumentLayout::PaintContext &)
Reimplements: QAbstractTextDocumentLayout::draw(QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context).
[override virtual] int PlainTextDocumentLayout::hitTest(const QPointF &, Qt::HitTestAccuracy) const
Reimplements: QAbstractTextDocumentLayout::hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const.
[override virtual] int PlainTextDocumentLayout::pageCount() const
Reimplements: QAbstractTextDocumentLayout::pageCount() const.
void PlainTextDocumentLayout::requestUpdate()
Requests a complete update on all views.
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.