diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-09-11 19:41:49 +0200 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-09-12 23:54:02 +0200 |
commit | 16da0b2cf8b6b344ae9dc37f46acec643c72fc28 (patch) | |
tree | 6c390bbd20c8fa60f3080539afaee39fcf402afc /src | |
parent | 3d7207414b07104c1ea03ef341301a7390d7b0ad (diff) |
QTranslator doc: use QCoreApplication::installTranslator()
The example snippet was using app.installTranslator() even
installTranslator() is a static function. And since app is a
QApplication instead a QCoreApplication this could lead to the
assumption that a QTranslator can only be used for gui applications.
Therefore use the correct static invocation
QCoreApplication::installTranslator().
Change-Id: Ia3ce00f25230c2fe2bdc159ec14c88c961924651
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/doc/snippets/hellotrmain.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/doc/snippets/hellotrmain.cpp b/src/corelib/doc/snippets/hellotrmain.cpp index 2fab919a47..721a83240b 100644 --- a/src/corelib/doc/snippets/hellotrmain.cpp +++ b/src/corelib/doc/snippets/hellotrmain.cpp @@ -56,13 +56,13 @@ int main(int argc, char *argv[]) QTranslator translator; // look up e.g. :/translations/myapp_de.qm if (translator.load(QLocale(), QLatin1String("myapp"), QLatin1String("_"), QLatin1String(":/translations"))) - app.installTranslator(&translator); + QCoreApplication::installTranslator(&translator); QPushButton hello(QCoreApplication::translate("main", "Hello world!")); hello.resize(100, 30); hello.show(); - return app.exec(); + return QCoreApplication::exec(); } //! [0] |