Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QEvent::LanguageChange can not stop



  • Hello :
    I'm a new guy on QT, developed a process and run on Embedded Linux.
    Once installTranslator() was implemented dynamically,
    the changeEvent() keep receiving QEvent::LanguageChange
    it is endless

    void BoxLanguage::changeTr(const QString& langCode)
    {
    static QTranslator* translator;
    if (translator != NULL)
    {
    qApp->removeTranslator(translator);
    delete translator;
    translator = NULL;
    }
    translator = new QTranslator;
    if (translator->load(langCode))
    {
    qApp->installTranslator(translator);
    }
    }

    void BoxLanguage::changeEvent(QEvent* e)
    {
    QWidget::changeEvent(e);
    switch (e->type())
    {
    case QEvent::LanguageChange:
    {
    fprintf(stderr, "BoxLanguage::QEvent::LanguageChange\n");
    }
    break;

        	default:
        	break;
        }
    

    }

    It always print on the screen : BoxLanguage::QEvent::LanguageChange

    what's the issue? anybody can help me?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    @realdada said in QEvent::LanguageChange can not stop:

    changeTr

    Are you sure that this method is not repeatedly called ?


Log in to reply