summaryrefslogtreecommitdiffstats
path: root/examples/widgets/dialogs/standarddialogs/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/dialogs/standarddialogs/main.cpp')
-rw-r--r--examples/widgets/dialogs/standarddialogs/main.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/examples/widgets/dialogs/standarddialogs/main.cpp b/examples/widgets/dialogs/standarddialogs/main.cpp
index 3892c02f9d..7e7a5ce95b 100644
--- a/examples/widgets/dialogs/standarddialogs/main.cpp
+++ b/examples/widgets/dialogs/standarddialogs/main.cpp
@@ -60,16 +60,17 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- QGuiApplication::setApplicationDisplayName(Dialog::tr("Standard Dialogs"));
-#ifndef QT_NO_TRANSLATION
- QString translatorFileName = QLatin1String("qtbase_");
- translatorFileName += QLocale::system().name();
- QTranslator *translator = new QTranslator(&app);
- if (translator->load(translatorFileName, QLibraryInfo::path(QLibraryInfo::TranslationsPath)))
- app.installTranslator(translator);
+#if QT_CONFIG(translation)
+ QTranslator translator;
+ if (translator.load(QLocale::system(), u"qtbase"_qs, u"_"_qs,
+ QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
+ app.installTranslator(&translator);
+ }
#endif
+ QGuiApplication::setApplicationDisplayName(Dialog::tr("Standard Dialogs"));
+
Dialog dialog;
if (!QGuiApplication::styleHints()->showIsFullScreen() && !QGuiApplication::styleHints()->showIsMaximized()) {
const QRect availableGeometry = dialog.screen()->availableGeometry();