[SOLVED] how to translate model dialogs in addition to mainwindow?
-
Hi all, my qt application could switch languages in mainwindow. But the 'tr' is not working in modal dialogs. Could anybody do me a help? Thanks in advance.
TS file and QM file already contain correct translations.
@
/* Modal Dialog Header File */
class DTRuleDialog : public QDialog
{
Q_OBJECT
public:
explicit DTRuleDialog(QWidget *parent = 0);
QLabel *labelFollow;
}
@@
/* Modal Dialog CPP File */
DTRuleDialog::DTRuleDialog(QWidget *parent) :
QDialog(parent)
{
labelFollow = new QLabel(tr("Follow"));
}
@@
/* MainWindow CPP File */DTMainWindow::DTMainWindow()
{
btnCustomize = new QPushButton("");
connect(btnCustomize, SIGNAL(clicked()), SLOT(rule()));
}void DTMainWindow::rules()
{
DTRuleDialog *ruleDialog = new DTRuleDialog(this);
ruleDialog->exec();
}
@ -
Hi and welcome to devnet,
Maybe a silly question, but are you loading the translation file properly in your application ?