QFileDialog
is used in my code like following:
QFileDialog fileDlg;
fileDlg.setFileMode(QFileDialog::AnyFile);
fileDlg.setViewMode(QFileDialog::
I know this has been answered and accepted but the correct way is not to manually translate what Qt already provides but rather to load the translations included in Qt like this:
/* load the system translations provided by Qt */
QTranslator qtTranslator;
qtTranslator.load("qt_" + QLocale::system().name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app.installTranslator(&qtTranslator);
/* load our custom translations for this application */
QTranslator myappTranslator;
myappTranslator.load("myapp_" + QLocale::system().name());
app.installTranslator(&myappTranslator);
This way Qt will translate what it already knows (like it's own widgets) and will use the custom translations provided with the application for the rest.