Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
hellotrmain.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
4using namespace Qt::StringLiterals;
5
7int main(int argc, char *argv[])
8{
9 QApplication app(argc, argv);
10
11 QTranslator translator;
12 // look up e.g. :/i18n/myapp_de.qm
13 if (translator.load(QLocale(), "myapp"_L1, "_"_L1, ":/i18n"_L1))
15
16 QPushButton hello(QCoreApplication::translate("main", "Hello world!"));
17 hello.resize(100, 30);
18
19 hello.show();
20 return app.exec();
21}
23
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...
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
static bool installTranslator(QTranslator *messageFile)
Adds the translation file translationFile to the list of translation files to be used for translation...
The QPushButton widget provides a command button.
Definition qpushbutton.h:20
\inmodule QtCore
Definition qtranslator.h:19
int main()
[0]
HelloWorldTask * hello
QApplication app(argc, argv)
[0]