Hi, there! I have a strange problem about .qm file which generated by linguist. For example, I have a main window which extends QMainWindow and 2 dialogs which extends QDialog. Then I use lupdate and linguist to generate .qm file to translate my application. But when I run this application, only the main window is translated, the dailogs are not! I don't know why. Here is my code, I think there maybe are some problem with the namespace.

Qt Code:
  1. // mainwindow.cpp
  2. #include <QAction>
  3. #include <QToolBar>
  4. #include "mainwindow.h"
  5. #include "dialog1.h"
  6. #include "dialog2.h"
  7.  
  8. app::MainWindow::MainWindow(QWidget *parent)
  9. : QMainWindow(parent)
  10. {
  11. QAction *openDialog1 = new QAction(tr("open dialog 1"), this);
  12. QAction *openDialog2 = new QAction(tr("open dialog 2"), this);
  13.  
  14. connect(openDialog1, SIGNAL(triggered()), this, SLOT(showDialog1()));
  15. connect(openDialog2, SIGNAL(triggered()), this, SLOT(showDialog2()));
  16.  
  17. QToolBar *bar = addToolBar(tr("Tool Bar"));
  18. bar->addAction(openDialog1);
  19. bar->addAction(openDialog2);
  20. }
  21.  
  22. app::MainWindow::~MainWindow()
  23. {
  24.  
  25. }
  26.  
  27. void app::MainWindow::showDialog1()
  28. {
  29. Dialog1 *d = new Dialog1(this);
  30. d->exec();
  31. }
  32.  
  33. void app::MainWindow::showDialog2()
  34. {
  35. Dialog2 *d = new Dialog2(this);
  36. d->exec();
  37. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. // dialog1.cpp
  2. #include "dialog1.h"
  3.  
  4. app::Dialog1::Dialog1(QWidget *parent)
  5. : QDialog(parent)
  6. {
  7. setWindowTitle(tr("Dialog 1"));
  8. }
  9.  
  10. // Class Dialog2 is the same as Dialog1, so the file is ingored.
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. // main.cpp
  2. #include <QtGui/QApplication>
  3. #include <QDebug>
  4. #include <QTranslator>
  5. #include "mainwindow.h"
  6.  
  7. int main(int argc, char *argv[])
  8. {
  9. using namespace app;
  10.  
  11. QApplication a(argc, argv);
  12.  
  13. qDebug() << t.load("../res/i18n_zh_CN");
  14. a.installTranslator(&t);
  15.  
  16. MainWindow w;
  17. w.show();
  18. return a.exec();
  19. }
To copy to clipboard, switch view to plain text mode 

qDebug() outputs true. This has confused for several days....