Important: Please read the Qt Code of Conduct -

Runtime Translation of Multiple Inheritance Approach Dialog

  • Hi i have the Problem of how to access the retranslateUI() function of an Dialog which i setup using the multiple Inheritance Approach:

    my headerfile looks like this

    @#ifndef SERVICESCREEN_H
    #include "ui_servicemenu.h"

    class myservicemenu : public QDialog, public Ui::servicemenu

    myservicemenu(QDialog *parent = 0);


    public slots:
    void on_pushButton_clicked();

    private slots:


    #endif // SERVICESCREEN_H@

    Constructor like this:
    @myservicemenu::myservicemenu(QDialog *parent) : QDialog(parent)


    now i want to access from the change Event in Mainwindow the retranslateUI() from my designer generated Ui_servicemenu, but i don't know how to achieve this.

    @void MainWindow::changeEvent(QEvent* event)
    if (event->type() == QEvent::LanguageChange)
    //Here i wanna call the retranslateUi() of my servicemenu form
    ui.retranslateUi(this);//<--this retranslates Mainwindow


    The retranslation of the MainWindow works but i also want to retranslate the servicemenu Dialog anyone has an advice?
    thx in advance

  • Hi,

    did you load the translations for Qt? You have to add a second QTranslator object and load the Qt translation files.

  • Hi, yes i did, i used te Example i found "here": and added my own new Dialog called servicemenu

    When i add an extra changeEvent like:
    @void myservicemenu::changeEvent(QEvent* event)

    if (event->type() == QEvent::LanguageChange)


    all my Dialogs get Translated but when i have a lots of Dialogs (>100) i need a change event for every Dialog instead of handling all in one Mainwindow::changeEvent?

  • You have to do it in every dialog I think.

Log in to reply