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
#define SERVICESCREEN_H
#include "ui_servicemenu.h"class myservicemenu : public QDialog, public Ui::servicemenu
{
Q_OBJECTpublic:
myservicemenu(QDialog *parent = 0);protected:
public slots:
void on_pushButton_clicked();private slots:
};
#endif // SERVICESCREEN_H@
Constructor like this:
@myservicemenu::myservicemenu(QDialog *parent) : QDialog(parent)
{
setupUi(this);}@
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}
QMainWindow::changeEvent(event);
}@The retranslation of the MainWindow works but i also want to retranslate the servicemenu Dialog anyone has an advice?
thx in advance -
Hi, yes i did, i used te Example i found "here":http://www.qtcentre.org/wiki/index.php?title=Dynamic_translation_in_Qt4_applications 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) { retranslateUi(this); }
}@
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?