PySide6.QtQuick.QQuickTextDocument¶
- class QQuickTextDocument¶
The
QQuickTextDocument
class provides access to the QTextDocument of QQuickTextEdit. More…Synopsis¶
Properties¶
errorStringᅟ
- Human-readable string describing the error that occurred during loading or saving, if anymodifiedᅟ
- Whether the document has been modified by the usersourceᅟ
- The URL from which to load document contentsstatusᅟ
- The status of document loading or saving
Methods¶
def
__init__()
def
errorString()
def
isModified()
def
save()
def
saveAs()
def
setModified()
def
setSource()
def
source()
def
status()
def
textDocument()
Signals¶
def
sourceChanged()
def
statusChanged()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
This class provides access to the QTextDocument of QQuickTextEdit elements. This is provided to allow usage of the Rich Text Processing functionalities of Qt, including document modifications. It can also be used to output content, for example with QTextDocumentWriter, or provide additional formatting, for example with QSyntaxHighlighter.
- class Status¶
Added in version 6.7.
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property errorStringᅟ: str¶
This property holds a human-readable string describing the error that occurred during loading or saving, if any.
By default this string is empty.
- Access functions:
- property modifiedᅟ: bool¶
This property holds whether the document has been modified by the user.
This property holds whether the document has been modified by the user since the last time it was loaded or saved. By default, this property is
false
.As with QTextDocument::modified, you can set the modified property: for example, set it to
false
to allow setting thesource
property to a different URL (thus discarding the user’s changes).See also
modified
- Access functions:
This property holds the URL from which to load document contents.
QQuickTextDocument
can handle any text format supported by Qt, loaded from any URL scheme supported by Qt.The
source
property cannot be changed while the document’smodified
state istrue
. If the user has modified the document contents, you should prompt the user whether tosave()
, or else discard changes by settingmodified
tofalse
before setting thesource
property to a different URL.See also
- Access functions:
Signal
sourceChanged()
- property statusᅟ: QQuickTextDocument.Status¶
This property holds the status of document loading or saving.
This property holds the status of document loading or saving. It can be one of:
Null
No file has been loaded
See also
- Access functions:
Signal
statusChanged()
- __init__(parent)¶
- Parameters:
parent –
QQuickItem
Constructs a
QQuickTextDocument
object withparent
as the parent object.- errorString()¶
- Return type:
str
Getter of property
errorStringᅟ
.- errorStringChanged()¶
Notification signal of property
errorStringᅟ
.- isModified()¶
- Return type:
bool
Getter of property
modifiedᅟ
.- modifiedChanged()¶
Notification signal of property
modifiedᅟ
.- save()¶
Saves the contents to the same file and format specified by
source
.Saves the contents to the file and format specified by
url
.The file extension in
url
specifies the file format (as determined by QMimeDatabase::mimeTypeForUrl()).- setModified(modified)¶
- Parameters:
modified – bool
See also
Setter of property
modifiedᅟ
.Setter of property
sourceᅟ
.- setTextDocument(document)¶
- Parameters:
document –
QTextDocument
Sets the given
document
.The caller retains ownership of the document.
See also
- source()¶
- Return type:
See also
Getter of property
sourceᅟ
.- sourceChanged()¶
Notification signal of property
sourceᅟ
.Getter of property
statusᅟ
.- statusChanged()¶
Notification signal of property
statusᅟ
.- textDocument()¶
- Return type:
Returns a pointer to the QTextDocument object.
See also
- textDocumentChanged()¶
This signal is emitted when the underlying QTextDocument is replaced with a different instance.
See also