Revision control
++ // Copyright (C) 2016 The Qt Company Ltd.
++ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
++ #include <QApplication>
++ #include <QTextEdit>
++
++ QString tr(const char *text)
++ {
++ return QApplication::translate(text, text);
++ }
++
++ int main(int argc, char *argv[])
++ {
++ QApplication app(argc, argv);
++ QTextEdit *editor = new QTextEdit;
++
++ //! [0]
++ QTextDocument *document = new QTextDocument(editor);
++ QTextCursor cursor(document);
++ //! [0]
++
++ //! [1]
++ QTextImageFormat imageFormat;
++ imageFormat.setName(":/images/advert.png");
++ cursor.insertImage(imageFormat);
++ //! [1]
++
++ cursor.insertBlock();
++ cursor.insertText("Code less. Create more.");
++
++ editor->setDocument(document);
++ editor->setWindowTitle(tr("Text Document Images"));
++ editor->resize(320, 480);
++ editor->show();
++ return app.exec();
++ }