Qt
6.x
The Qt SDK
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
{
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
);
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
30
QTextEdit
*editor =
new
QTextEdit
(
parent
);
31
editor->
setHtml
(aStringContainingHTMLtext);
32
editor->show();
34
35
return
app
.
exec
();
36
}
QApplication
The QApplication class manages the GUI application's control flow and main settings.
Definition
qapplication.h:32
QApplication::exec
static int exec()
Enters the main event loop and waits until exit() is called, then returns the value that was set to e...
Definition
qapplication.cpp:2564
QFont::Bold
@ Bold
Definition
qfont.h:67
QString
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition
qstring.h:127
QTextCharFormat
\reentrant
Definition
qtextformat.h:382
QTextCursor
\reentrant \inmodule QtGui
Definition
qtextcursor.h:30
QTextCursor::KeepAnchor
@ KeepAnchor
Definition
qtextcursor.h:49
QTextCursor::EndOfLine
@ EndOfLine
Definition
qtextcursor.h:77
QTextCursor::Start
@ Start
Definition
qtextcursor.h:64
QTextDocument
\reentrant \inmodule QtGui
Definition
qtextdocument.h:57
QTextEdit
The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
Definition
qtextedit.h:27
QTextEdit::setHtml
void setHtml(const QString &text)
Definition
qtextedit.cpp:1199
QWidget
The QWidget class is the base class of all user interface objects.
Definition
qwidget.h:99
main
int main()
[0]
Definition
doc_src_objecttrees.cpp:5
cursor
QCursor cursor
Definition
doc_src_properties.cpp:25
format
GLint GLsizei GLsizei GLenum format
Definition
qopengles2ext.h:206
mergeFormat
void mergeFormat(QTextEdit *edit)
Definition
main.cpp:6
edit
QLineEdit * edit
Definition
src_gui_graphicsview_qgraphicsproxywidget.cpp:39
app
QApplication app(argc, argv)
[0]
parent
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent
Definition
uiaclientinterfaces_p.h:209
qtbase
src
gui
doc
snippets
scribe-overview
main.cpp
Generated by
1.9.7