Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3#include <QApplication>
4#include <QTextEdit>
5
6QString tr(const char *text)
7{
8 return QApplication::translate(text, text);
9}
10
11int main(int argc, char *argv[])
12{
13 QApplication app(argc, argv);
14 QTextEdit *editor = new QTextEdit;
15
16//! [0]
17 QTextDocument *document = new QTextDocument(editor);
18 QTextCursor cursor(document);
19//! [0]
20
21//! [1]
22 QTextImageFormat imageFormat;
23 imageFormat.setName(":/images/advert.png");
24 cursor.insertImage(imageFormat);
25//! [1]
26
27 cursor.insertBlock();
28 cursor.insertText("Code less. Create more.");
29
30 editor->setDocument(document);
31 editor->setWindowTitle(tr("Text Document Images"));
32 editor->resize(320, 480);
33 editor->show();
34 return app.exec();
35}
int main(int argc, char *argv[])
[ctor_close]
QString tr(const char *)