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
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
4#include <QApplication>
5#include <QTranslator>
6#include <QPushButton>
7//! [0]
8// Required for using the '_L1' string literal.
9using namespace Qt::StringLiterals;
10
11int main(int argc, char *argv[])
12{
13 QApplication app(argc, argv);
14
15 QTranslator translator;
16 // look up e.g. :/i18n/myapp_de.qm
17 if (translator.load(QLocale(), "myapp"_L1, "_"_L1, ":/i18n"_L1))
18 QCoreApplication::installTranslator(&translator);
19
20 QPushButton hello(QCoreApplication::translate("main", "Hello world!"));
21 hello.resize(100, 30);
22
23 hello.show();
24 return app.exec();
25}
26//! [0]
int main(int argc, char *argv[])
[ctor_close]