Qt Quick Controls - Text Editor Example
The Text Editor Example presents a sample HTML file using the TextArea control, preserving the HTML formatting. It uses a C++ class to handle the document by providing options to open, format, and edit. The app also lets you open and edit a plain text files.
The C++ class, DocumentHandler, extends QObject and is registered as a QML type under the namespace, "
The following snippets show how the type is registered under a namespace and later imported by main.qml.
QML type registration:
#include <QtQml/qqml.h> ... qmlRegisterType<DocumentHandler>("org.qtproject.example", 1, 0, "DocumentHandler"); ...
QML namespace import:
import org.qtproject.example 1.0
For more information about registering C++ classes as QML types, see Defining QML Types from C++.
© 2020 The Qt Company Ltd. 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.