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
void
mergeFormat
(QTextEdit *edit)
7
{
8
//! [0]
9
QTextDocument *document = edit->document();
10
QTextCursor cursor(document);
11
12
cursor.movePosition(QTextCursor::Start);
13
cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
14
15
QTextCharFormat format;
16
format.setFontWeight(QFont::Bold);
17
18
cursor.mergeCharFormat(format);
19
//! [0]
20
}
21
22
int
main
(
int
argc,
char
*argv[])
23
{
24
QWidget *parent =
nullptr
;
25
QString aStringContainingHTMLtext(
"<h1>Scribe Overview</h1>"
);
26
27
QApplication app(argc, argv);
28
29
//! [1]
30
QTextEdit *editor =
new
QTextEdit(parent);
31
editor->setHtml(aStringContainingHTMLtext);
32
editor->show();
33
//! [1]
34
35
return
app.exec();
36
}
mergeFormat
void mergeFormat(QTextEdit *edit)
Definition
main.cpp:6
main
int main(int argc, char *argv[])
[ctor_close]
Definition
src_corelib_animation_qpropertyanimation.cpp:100
qtbase
src
gui
doc
snippets
scribe-overview
main.cpp
Generated on
for Qt by
1.18.0