PythonQt.QtGui.QTextDocument · declarations 003
Back to PythonQt.QtGui.QTextDocument
revision
revision() -> int
X.revision() -> int
Supplemental documentation: Qt 5 reference:
int QTextDocument::revision() const
Returns the document's revision (if undo is enabled).
The revision is guaranteed to increase when a document that is not modified is edited.
This function was introduced in Qt 4.4.
See also QTextBlock::revision() and isModified().
Upstream PySide2 reference signatures (binding differences may apply):
revision(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#revision
rootFrame
rootFrame() -> Any
X.rootFrame() -> PythonQt.QtGui.QTextFrame
Supplemental documentation: Qt 5 reference:
QTextFrame *QTextDocument::rootFrame() const
Returns the document's root frame.
Upstream PySide2 reference signatures (binding differences may apply):
rootFrame(self) -> PySide2.QtGui.QTextFrame
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#rootFrame
setBaseUrl
setBaseUrl(url: Any) -> None
X.setBaseUrl(url)
Upstream PySide2 reference signatures (binding differences may apply):
setBaseUrl(self, url: PySide2.QtCore.QUrl) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setBaseUrl
setDefaultCursorMoveStyle
setDefaultCursorMoveStyle(style: Any) -> None
X.setDefaultCursorMoveStyle(style)
Supplemental documentation: Qt 5 reference:
void QTextDocument::setDefaultCursorMoveStyle(Qt::CursorMoveStyle style)
Sets the default cursor movement style to the given style.
This function was introduced in Qt 4.8.
See also defaultCursorMoveStyle().
Upstream PySide2 reference signatures (binding differences may apply):
setDefaultCursorMoveStyle(self, style: PySide2.QtCore.Qt.CursorMoveStyle) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setDefaultCursorMoveStyle
setDefaultFont
setDefaultFont(font: Any) -> None
X.setDefaultFont(font)
Supplemental documentation: Qt 5 reference:
void QTextDocument::setDefaultFont(const QFont \&font)
Sets the default font to use in the document layout.
Note: Setter function for property defaultFont.
See also defaultFont().
Upstream PySide2 reference signatures (binding differences may apply):
setDefaultFont(self, font: PySide2.QtGui.QFont) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setDefaultFont
setDefaultStyleSheet
setDefaultStyleSheet(sheet: str) -> None
X.setDefaultStyleSheet(sheet)
Upstream PySide2 reference signatures (binding differences may apply):
setDefaultStyleSheet(self, sheet: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setDefaultStyleSheet
setDefaultTextOption
setDefaultTextOption(option: Any) -> None
X.setDefaultTextOption(option)
Supplemental documentation: Qt 5 reference:
void QTextDocument::setDefaultTextOption(const QTextOption \&option)
Sets the default text option to option.
Note: Setter function for property defaultTextOption.
This function was introduced in Qt 4.3.
See also defaultTextOption().
Upstream PySide2 reference signatures (binding differences may apply):
setDefaultTextOption(self, option: PySide2.QtGui.QTextOption) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setDefaultTextOption
setDocumentLayout
setDocumentLayout(layout: Any) -> None
X.setDocumentLayout(layout)
Supplemental documentation: Qt 5 reference:
void QTextDocument::setDocumentLayout(QAbstractTextDocumentLayout *layout)
Sets the document to use the given layout. The previous layout is deleted.
See also documentLayoutChanged().
Upstream PySide2 reference signatures (binding differences may apply):
setDocumentLayout(self, layout: PySide2.QtGui.QAbstractTextDocumentLayout) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setDocumentLayout
setDocumentMargin
setDocumentMargin(margin: float) -> None
X.setDocumentMargin(margin)
Upstream PySide2 reference signatures (binding differences may apply):
setDocumentMargin(self, margin: float) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setDocumentMargin
setHtml
setHtml(html: str) -> None
X.setHtml(html)
Supplemental documentation: Qt 5 reference:
void QTextDocument::setHtml(const QString \&html)
Replaces the entire contents of the document with the given HTML-formatted text in the html string. The undo/redo history is reset when this function is called.
The HTML formatting is respected as much as possible; for example, "\<b>bold\</b> text" will produce text where the first word has a font weight that gives it a bold appearance: "bold text".
Note: It is the responsibility of the caller to make sure that the text is correctly decoded when a QString containing HTML is created and passed to setHtml().
See also setPlainText() and Supported HTML Subset.
Upstream PySide2 reference signatures (binding differences may apply):
setHtml(self, html: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setHtml
setIndentWidth
setIndentWidth(width: float) -> None
X.setIndentWidth(width)
Supplemental documentation: Qt 5 reference:
void QTextDocument::setIndentWidth(qreal width)
Sets the width used for text list and text block indenting.
The indent properties of QTextListFormat and QTextBlockFormat specify multiples of this value. The default indent width is 40 .
Note: Setter function for property indentWidth.
This function was introduced in Qt 4.4.
See also indentWidth().
Upstream PySide2 reference signatures (binding differences may apply):
setIndentWidth(self, width: float) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setIndentWidth
setMaximumBlockCount
setMaximumBlockCount(maximum: int) -> None
X.setMaximumBlockCount(maximum)
Upstream PySide2 reference signatures (binding differences may apply):
setMaximumBlockCount(self, maximum: int) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setMaximumBlockCount
setMetaInformation
setMetaInformation(info: Any, arg__2: str) -> None
X.setMetaInformation(info, arg__2)
Supplemental documentation: Qt 5 reference:
void QTextDocument::setMetaInformation(QTextDocument::MetaInformation info, const QString \&string)
Sets the document's meta information of the type specified by info to the given string.
See also metaInformation().
Upstream PySide2 reference signatures (binding differences may apply):
setMetaInformation(self, info: PySide2.QtGui.QTextDocument.MetaInformation, arg__2: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setMetaInformation
setModified
setModified(m: bool) -> None
X.setModified(m)
Upstream PySide2 reference signatures (binding differences may apply):
setModified(self, m: bool=...) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setModified
setPageSize
setPageSize(size: Any) -> None
X.setPageSize(size)
Upstream PySide2 reference signatures (binding differences may apply):
setPageSize(self, size: PySide2.QtCore.QSizeF) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setPageSize
setPlainText
setPlainText(text: str) -> None
X.setPlainText(text)
Supplemental documentation: Qt 5 reference:
void QTextDocument::setPlainText(const QString \&text)
Replaces the entire contents of the document with the given plain text. The undo/redo history is reset when this function is called.
See also setHtml().
Upstream PySide2 reference signatures (binding differences may apply):
setPlainText(self, text: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setPlainText
setTextWidth
setTextWidth(width: float) -> None
X.setTextWidth(width)
Upstream PySide2 reference signatures (binding differences may apply):
setTextWidth(self, width: float) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setTextWidth
setUndoRedoEnabled
setUndoRedoEnabled(enable: bool) -> None
X.setUndoRedoEnabled(enable)
Upstream PySide2 reference signatures (binding differences may apply):
setUndoRedoEnabled(self, enable: bool) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setUndoRedoEnabled
setUseDesignMetrics
setUseDesignMetrics(b: bool) -> None
X.setUseDesignMetrics(b)
Upstream PySide2 reference signatures (binding differences may apply):
setUseDesignMetrics(self, b: bool) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#setUseDesignMetrics
size
instance-attribute
size: QSizeF
Qt 5 reference:
size : const QSizeF
Returns the actual size of the document. This is equivalent to documentLayout()->documentSize();
The size of the document can be changed either by setting a text width or setting an entire page size.
Note that the width is always >\= pageSize().width().
By default, for a newly-created, empty document, this property contains a configuration-dependent size.
This property was introduced in Qt 4.2.
Access functions:
| QSizeF | size() const |
|---|---|
See also setTextWidth(), setPageSize(), and idealWidth().
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#size
textWidth
instance-attribute
textWidth: float
Qt 5 reference:
textWidth : qreal
The text width specifies the preferred width for text in the document. If the text (or content in general) is wider than the specified with it is broken into multiple lines and grows vertically. If the text cannot be broken into multiple lines to fit into the specified text width it will be larger and the size() and the idealWidth() property will reflect that.
If the text width is set to -1 then the text will not be broken into multiple lines unless it is enforced through an explicit line break or a new paragraph.
The default value is -1.
Setting the text width will also set the page height to -1, causing the document to grow or shrink vertically in a continuous way. If you want the document layout to break the text into multiple pages then you have to set the pageSize property instead.
This property was introduced in Qt 4.2.
Access functions:
| qreal | textWidth() const |
|---|---|
| void | setTextWidth(qreal width) |
See also size(), idealWidth(), and pageSize().
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#textWidth
toHtml
toHtml(encoding: Any) -> str
X.toHtml(encoding) -> str
Supplemental documentation: Qt 5 reference:
QString QTextDocument::toHtml(const QByteArray \&encoding \= QByteArray()) const
Returns a string containing an HTML representation of the document.
The encoding parameter specifies the value for the charset attribute in the html header. For example if 'utf-8' is specified then the beginning of the generated html will look like this:
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>...
If no encoding is specified then no such meta information is generated.
If you later on convert the returned html string into a byte array for transmission over a network or when saving to disk you should specify the encoding you're going to use for the conversion to a byte array here.
See also Supported HTML Subset.
Upstream PySide2 reference signatures (binding differences may apply):
toHtml(self, encoding: PySide2.QtCore.QByteArray=...) -> str
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#toHtml
toPlainText
toPlainText() -> str
X.toPlainText() -> str
Supplemental documentation: Qt 5 reference:
QString QTextDocument::toPlainText() const
Returns the plain text contained in the document. If you want formatting information use a QTextCursor instead.
This function returns the same as toRawText(), but will replace some unicode characters with ASCII alternatives. In particular, no-break space (U+00A0) is replaced by a regular space (U+0020), and both paragraph (U+2029) and line (U+2028) separators are replaced by line feed (U+000A). If you need the precise contents of the document, use toRawText() instead.
Note: Embedded objects, such as images, are represented by a Unicode value U+FFFC (OBJECT REPLACEMENT CHARACTER).
See also toHtml().
Upstream PySide2 reference signatures (binding differences may apply):
toPlainText(self) -> str
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#toPlainText
undo
undo(cursor: Any) -> None
X.undo(cursor)
Supplemental documentation: Qt 5 reference:
[slot] void QTextDocument::undo()
This is an overloaded function.
void QTextDocument::undo(QTextCursor *cursor)
Undoes the last editing operation on the document if undo is available. The provided cursor is positioned at the end of the location where the edition operation was undone.
See the Qt Undo Framework documentation for details.
This function was introduced in Qt 4.2.
See also undoAvailable() and isUndoRedoEnabled().
Upstream PySide2 reference signatures (binding differences may apply):
undo(self) -> None
undo(self, cursor: PySide2.QtGui.QTextCursor) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#undo
undoAvailable
undoAvailable(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtGui.QTextDocument.undoAvailable; argument details are not documented.
Supplemental documentation: Qt 5 reference:
[signal] void QTextDocument::undoAvailable(bool available)
This signal is emitted whenever undo operations become available (available is true) or unavailable (available is false).
See the Qt Undo Framework documentation for details.
See also undo() and isUndoRedoEnabled().
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#undoAvailable
undoCommandAdded
undoCommandAdded(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtGui.QTextDocument.undoCommandAdded; argument details are not documented.
Supplemental documentation: Qt 5 reference:
[signal] void QTextDocument::undoCommandAdded()
This signal is emitted every time a new level of undo is added to the QTextDocument.
This function was introduced in Qt 4.4.
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#undoCommandAdded
undoRedoEnabled
instance-attribute
undoRedoEnabled: Any
Qt 5 reference:
undoRedoEnabled : bool
This property holds whether undo/redo are enabled for this document
This defaults to true. If disabled, the undo stack is cleared and no items will be added to it.
Access functions:
| bool | isUndoRedoEnabled() const |
|---|---|
| void | setUndoRedoEnabled(bool enable) |
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#undoRedoEnabled
useDesignMetrics
instance-attribute
useDesignMetrics: bool
Qt 5 reference:
useDesignMetrics : bool
This property holds whether the document uses design metrics of fonts to improve the accuracy of text layout
If this property is set to true, the layout will use design metrics. Otherwise, the metrics of the paint device as set on QAbstractTextDocumentLayout::setPaintDevice() will be used.
Using design metrics makes a layout have a width that is no longer dependent on hinting and pixel-rounding. This means that WYSIWYG text layout becomes possible because the width scales much more linearly based on paintdevice metrics than it would otherwise.
By default, this property is false.
This property was introduced in Qt 4.1.
Access functions:
| bool | useDesignMetrics() const |
|---|---|
| void | setUseDesignMetrics(bool b) |
Source: https://doc.qt.io/archives/qt-5.15/qtextdocument.html#useDesignMetrics