11int main(
int argc,
char *argv[])
35 cursor.insertText(
tr(
"Character formats"),
40 cursor.insertText(
tr(
"Text can be displayed in a variety of "
41 "different character formats. "), plainFormat);
42 cursor.insertText(
tr(
"We can emphasize text by "));
43 cursor.insertText(
tr(
"making it italic"), emphasisFormat);
45 cursor.insertText(
tr(
", give it a "), plainFormat);
46 cursor.insertText(
tr(
"different color "), qtFormat);
47 cursor.insertText(
tr(
"to the default text color, "), plainFormat);
48 cursor.insertText(
tr(
"underline it"), underlineFormat);
49 cursor.insertText(
tr(
", and use many other effects."), plainFormat);
51 editor->setWindowTitle(
tr(
"Text Document Character Formats"));
52 editor->resize(320, 480);
The QApplication class manages the GUI application's control flow and main settings.
static int exec()
Enters the main event loop and waits until exit() is called, then returns the value that was set to e...
The QColor class provides colors based on RGB, HSV or CMYK values.
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
\macro QT_RESTRICTED_CAST_FROM_ASCII
void setFontPointSize(qreal size)
Sets the text format's font size.
void setFontUnderline(bool underline)
If underline is true, sets the text format's font to be underlined; otherwise it is displayed non-und...
void setFontItalic(bool italic)
If italic is true, sets the text format's font to be italic; otherwise the font will be non-italic.
void setFontWeight(int weight)
Sets the text format's font weight to weight.
\reentrant \inmodule QtGui
The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
QTextCursor textCursor() const
Returns a copy of the QTextCursor that represents the currently visible cursor.
void setForeground(const QBrush &brush)
Sets the foreground brush to the specified brush.
QApplication app(argc, argv)
[0]