IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QQuickTextDocument Class

The QQuickTextDocument class provides access to the QTextDocument of QQuickTextEdit.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QQuickTextDocument Class

  • Header: QQuickTextDocument

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Quick)

    target_link_libraries(mytarget PRIVATE Qt6::Quick)

  • qmake: QT += quick

  • Inherited By:

  • Instantiated By: qml-qtquick-textdocument.xml

  • Inherits: QObject

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.

Property Documentation

 

[read-only, since 6.7] errorString : const QString

This property is under development and is subject to change.

This property holds a human-readable string describing the error that occurred during loading or saving, if any

By default this string is empty.

This property was introduced in Qt 6.7.

Access functions:

  • errorString() const

Notifier signal:

See Also

See also status, source, save(), saveAs()

[since 6.7] modified : bool

This property is under development and is subject to change.

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 the source property to a different URL (thus discarding the user's changes).

This property was introduced in Qt 6.7.

Access functions:

  • bool isModified() const

  • void setModified(bool modified)

Notifier signal:

See Also

[since 6.7] source : QUrl

This property is under development and is subject to change.

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's modified state is true. If the user has modified the document contents, you should prompt the user whether to save(), or else discard changes by setting modified to false before setting the source property to a different URL.

This property was introduced in Qt 6.7.

Access functions:

  • source() const

  • void setSource(const &url)

Notifier signal:

See Also

[read-only, since 6.7] status : const Status

This property is under development and is subject to change.

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:

Constant

Description

Null

No file has been loaded

Loading

Reading from source has begun

Loaded

Reading has successfully finished

Saving

File writing has begun after save() or saveAs()

Saved

Writing has successfully finished

ReadError

An error occurred while reading from source

WriteError

An error occurred in save() or saveAs()

NonLocalFileError

saveAs() was called with a URL pointing to a remote resource rather than a local file

This property was introduced in Qt 6.7.

Access functions:

  • QQuickTextDocument::Status status() const

Notifier signal:

See Also

See also errorString, source, save(), saveAs()

Member Function Documentation

 

QQuickTextDocument::QQuickTextDocument(QQuickItem *parent)

Constructs a QQuickTextDocument object with parent as the parent object.

void QQuickTextDocument::errorStringChanged()

This function is under development and is subject to change.

Notifier signal for property errorString.

void QQuickTextDocument::modifiedChanged()

This function is under development and is subject to change.

Notifier signal for property modified.

[since 6.7] void QQuickTextDocument::save()

This function is under development and is subject to change.

Saves the contents to the same file and format specified by source.

You can save only to a file on a mounted filesystem.

This function was introduced in Qt 6.7.

See Also

See also source, saveAs()

[since 6.7] void QQuickTextDocument::saveAs(const QUrl &url)

This function is under development and is subject to change.

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()).

You can save only to a file on a mounted filesystem.

This function was introduced in Qt 6.7.

See Also

See also source, save()

[since 6.7] void QQuickTextDocument::setTextDocument(QTextDocument *document)

Sets the given document.

The caller retains ownership of the document.

This function was introduced in Qt 6.7.

See Also

See also textDocument()

void QQuickTextDocument::sourceChanged()

This function is under development and is subject to change.

Notifier signal for property source.

void QQuickTextDocument::statusChanged()

This function is under development and is subject to change.

Notifier signal for property status.

QTextDocument *QQuickTextDocument::textDocument() const

Returns a pointer to the QTextDocument object.

See Also

See also setTextDocument()

[since 6.7] void QQuickTextDocument::textDocumentChanged()

This signal is emitted when the underlying QTextDocument is replaced with a different instance.

This function was introduced in Qt 6.7.

See Also

See also setTextDocument()

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+