PDA

View Full Version : lupdate having problem to identify correct tr() caller



Momergil
4th August 2014, 13:59
Hello!

I'm having a problem regarding a calling of lupdate: it is reporting "Cannot invoke tr() like this" for a situation that it seems fine:

I have a global pointer (called in other files by a 'externed' pointer) to a subclass of QSplashScreen (SplashScreen) that has the Q_OBJECT macro. The global pointer is in the main.cpp file and what happens is that, when I call



g_mainSplashScreen->showMessage(g_mainSplashScreen->tr("Booting the system..."));


in the main() method or in a non-Q_OBJECT-derived class' method, I get the error mentioned above (g_mainSplashScreen is the global pointer to my SplashScreen class).

My question is: was that supposed to happen? since I'm calling SplashScreen' tr() method, isn't it providing the required context for tr() to work (since it is both a QObject derived class and has the Q_OBJECT macro)?


It's also interesting that, in the first call to g_mainSplashScreen->tr() not in the main() method, but inside a method from a class which is not QObject-derived (Interface::StructureDirector), a message is also sad in the terminal: "Class 'Interface::StructureDirector' lacks Q_OBJECT macro". Now that is true, but the problem is that I'm not calling a tr() from Interface::StructureDirector, but from my SplashScreen class which is the correct context for the tr() call \o/


So where could the problem be?

I hope I was clear enough; if code is required, just ask, although it would be quite a lot of code :x


Thanks,

Momergil