mercibac

qmltranslator.cpp

May 25th, 2021 (edited)
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include "qmltranslator.h"
  2. #include <QGuiApplication>
  3.  
  4. QmlTranslator::QmlTranslator(QObject *parent) : QObject(parent)
  5. {
  6.  
  7. }
  8.  
  9. void QmlTranslator::setTranslation(QString translation)
  10. {
  11.     m_translator.load(":/QmlLanguage_" + translation, "."); // load translation
  12.     qApp->installTranslator(&m_translator);                 // Set it to the application
  13.     emit languageChanged();                                 // Signaling a change in the current translation
  14. }
Add Comment
Please, Sign In to add comment