Hi everybody,

I would like to know usage of QT_TR_NOOP() (not QT_TRANSLATE_NOOP()).

I use the Qt SDK 4.5.1 in Linux/X11 and work in Qt Creator 1.1.0.

I wrote a sample code as follows.
Qt Code:
  1. #include <QApplication>
  2. #include <QMainWindow>
  3. #include <QTranslator>
  4. #include <QString>
  5. #include <QtGlobal>
  6.  
  7. class MyMessage {
  8. Q_DECLARE_TR_FUNCTIONS(MyMessage)
  9. public:
  10. MyMessage(){}
  11. ~MyMessage(){}
  12.  
  13. static QString GetMessage() {
  14. static const char* message = QT_TR_NOOP("Hello");
  15. return QString(QObject::tr(message));
  16. }
  17. };
  18.  
  19. int main(int argc, char *argv[])
  20. {
  21. QApplication application(argc, argv);
  22. QMainWindow mainWindow;
  23. QTranslator translator;
  24.  
  25. translator.load("./MyAppMessages.qm");
  26. application.installTranslator(&translator);
  27.  
  28. mainWindow.setWindowTitle(MyMessage::GetMessage());
  29. mainWindow.show();
  30.  
  31. return application.exec();
  32. }
To copy to clipboard, switch view to plain text mode 

And I made "MyAppMessages.qm" with lupdate, Qt Linguist, and lrelease to translate the message "Hello" into Japanese.
And I built and ran the program.
but window title was "Hello" yet.

Although I am studying English hard, my English is not great yet,
and I may make many mistakes. So, please be patient with me.

Thank you very much for any kind of help.
kichi