Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
6
QString
tr
(
const
char
*text)
7
{
8
return
QApplication::translate(text, text);
9
}
10
11
int
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
}
main
int main(int argc, char *argv[])
[ctor_close]
Definition
src_corelib_animation_qpropertyanimation.cpp:100
tr
QString tr(const char *)
Definition
src_corelib_global_qglobal_widgets.cpp:67
qtbase
src
gui
doc
snippets
textdocument-images
main.cpp
Generated on
for Qt by
1.18.0