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