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 <QTextBrowser>
5
6int main(int argc, char **argv)
7{
8 QApplication app(argc, argv);
9
11 QTextBrowser browser;
12 QColor linkColor(Qt::red);
13 QString sheet = QString::fromLatin1("a { text-decoration: underline; color: %1 }").arg(linkColor.name());
14 browser.document()->setDefaultStyleSheet(sheet);
16 browser.setSource(QUrl("../../../html/index.html"));
17 browser.resize(800, 600);
18 browser.show();
19
20 return app.exec();
21}
22
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.
Definition qcolor.h:31
QString name(NameFormat format=HexRgb) const
Definition qcolor.cpp:834
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5710
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
Definition qstring.cpp:8606
The QTextBrowser class provides a rich text browser with hypertext navigation.
void setSource(const QUrl &name, QTextDocument::ResourceType type=QTextDocument::UnknownResource)
Attempts to load the document at the given url with the specified type.
void setDefaultStyleSheet(const QString &sheet)
QTextDocument * document
the underlying document of the text editor.
Definition qtextedit.h:51
\inmodule QtCore
Definition qurl.h:94
int main()
[0]
@ red
Definition qnamespace.h:34
QApplication app(argc, argv)
[0]