Logo Search packages:      
Sourcecode: qt4-x11 version File versions

void QCoreApplication::installTranslator ( QTranslator translationFile  )  [static, inherited]

Adds the translation file translationFile to the list of translation files to be used for translations.

Multiple translation files can be installed. Translations are searched for in the reverse order in which they were installed, so the most recently installed translation file is searched first and the first translation file installed is searched last. The search stops as soon as a translation containing a matching string is found.

Installing or removing a QTranslator, or changing an installed QTranslator generates a {QEvent::LanguageChange}{LanguageChange} event for the QCoreApplication instance. A QApplication instance will propagate the event to all toplevel windows, where a reimplementation of changeEvent can re-translate the user interface by passing user-visible strings via the tr() function to the respective property setters. User-interface classes generated by {Qt Designer} provide a retranslateUi() function that can be called.

See also:
removeTranslator() translate() QTranslator::load() {Dynamic Translation}

Definition at line 1494 of file qcoreapplication.cpp.

References QTranslator::isEmpty(), and QCoreApplication::sendEvent().

    if (!translationFile)

    if (!QCoreApplicationPrivate::checkInstance("installTranslator"))
    QCoreApplicationPrivate *d = self->d_func();

    if (translationFile->isEmpty())

    QEvent ev(QEvent::LanguageChange);
    QCoreApplication::sendEvent(self, &ev);

Generated by  Doxygen 1.6.0   Back to index